
Co-authored-by: GuanMu <ballmanjq@gmail.com> Co-authored-by: zhujiruo <zhujiruo@foxmail.com> Co-authored-by: Matri Qi <matrixdom@126.com> Co-authored-by: croatialu <wuli.croatia@foxmail.com> Co-authored-by: HyaCinth <88471803+HyaCiovo@users.noreply.github.com> Co-authored-by: lyzno1 <92089059+lyzno1@users.noreply.github.com>
26 lines
681 B
TypeScript
26 lines
681 B
TypeScript
import type { AppMode } from '@/types/app'
|
|
|
|
export const getRedirectionPath = (
|
|
isCurrentWorkspaceEditor: boolean,
|
|
app: { id: string, mode: AppMode },
|
|
) => {
|
|
if (!isCurrentWorkspaceEditor) {
|
|
return `/app/${app.id}/overview`
|
|
}
|
|
else {
|
|
if (app.mode === 'workflow' || app.mode === 'advanced-chat')
|
|
return `/app/${app.id}/workflow`
|
|
else
|
|
return `/app/${app.id}/configuration`
|
|
}
|
|
}
|
|
|
|
export const getRedirection = (
|
|
isCurrentWorkspaceEditor: boolean,
|
|
app: { id: string, mode: AppMode },
|
|
redirectionFunc: (href: string) => void,
|
|
) => {
|
|
const redirectionPath = getRedirectionPath(isCurrentWorkspaceEditor, app)
|
|
redirectionFunc(redirectionPath)
|
|
}
|