dify
This commit is contained in:
25
dify/web/utils/app-redirection.ts
Normal file
25
dify/web/utils/app-redirection.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
|
||||
export const getRedirectionPath = (
|
||||
isCurrentWorkspaceEditor: boolean,
|
||||
app: { id: string, mode: AppModeEnum },
|
||||
) => {
|
||||
if (!isCurrentWorkspaceEditor) {
|
||||
return `/app/${app.id}/overview`
|
||||
}
|
||||
else {
|
||||
if (app.mode === AppModeEnum.WORKFLOW || app.mode === AppModeEnum.ADVANCED_CHAT)
|
||||
return `/app/${app.id}/workflow`
|
||||
else
|
||||
return `/app/${app.id}/configuration`
|
||||
}
|
||||
}
|
||||
|
||||
export const getRedirection = (
|
||||
isCurrentWorkspaceEditor: boolean,
|
||||
app: { id: string, mode: AppModeEnum },
|
||||
redirectionFunc: (href: string) => void,
|
||||
) => {
|
||||
const redirectionPath = getRedirectionPath(isCurrentWorkspaceEditor, app)
|
||||
redirectionFunc(redirectionPath)
|
||||
}
|
||||
Reference in New Issue
Block a user