2025-11-12 09:59:37 +00:00
|
|
|
import { AppModeEnum } from '@/types/app'
|
2025-03-18 03:12:25 +00:00
|
|
|
|
2025-08-11 02:19:52 +00:00
|
|
|
export const getRedirectionPath = (
|
2024-06-14 12:34:25 +00:00
|
|
|
isCurrentWorkspaceEditor: boolean,
|
2025-11-12 09:59:37 +00:00
|
|
|
app: { id: string, mode: AppModeEnum },
|
2024-04-08 10:51:46 +00:00
|
|
|
) => {
|
2024-06-14 12:34:25 +00:00
|
|
|
if (!isCurrentWorkspaceEditor) {
|
2025-08-11 02:19:52 +00:00
|
|
|
return `/app/${app.id}/overview`
|
2024-04-08 10:51:46 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2025-11-12 09:59:37 +00:00
|
|
|
if (app.mode === AppModeEnum.WORKFLOW || app.mode === AppModeEnum.ADVANCED_CHAT)
|
2025-08-11 02:19:52 +00:00
|
|
|
return `/app/${app.id}/workflow`
|
2024-04-08 10:51:46 +00:00
|
|
|
else
|
2025-08-11 02:19:52 +00:00
|
|
|
return `/app/${app.id}/configuration`
|
2024-04-08 10:51:46 +00:00
|
|
|
}
|
|
|
|
|
}
|
2025-08-11 02:19:52 +00:00
|
|
|
|
|
|
|
|
export const getRedirection = (
|
|
|
|
|
isCurrentWorkspaceEditor: boolean,
|
2025-11-12 09:59:37 +00:00
|
|
|
app: { id: string, mode: AppModeEnum },
|
2025-08-11 02:19:52 +00:00
|
|
|
redirectionFunc: (href: string) => void,
|
|
|
|
|
) => {
|
|
|
|
|
const redirectionPath = getRedirectionPath(isCurrentWorkspaceEditor, app)
|
|
|
|
|
redirectionFunc(redirectionPath)
|
|
|
|
|
}
|