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