app-redirection.ts 479 B

1234567891011121314151617
  1. import type { AppMode } from '@/types/app'
  2. export const getRedirection = (
  3. isCurrentWorkspaceEditor: boolean,
  4. app: { id: string, mode: AppMode },
  5. redirectionFunc: (href: string) => void,
  6. ) => {
  7. if (!isCurrentWorkspaceEditor) {
  8. redirectionFunc(`/app/${app.id}/overview`)
  9. }
  10. else {
  11. if (app.mode === 'workflow' || app.mode === 'advanced-chat')
  12. redirectionFunc(`/app/${app.id}/workflow`)
  13. else
  14. redirectionFunc(`/app/${app.id}/configuration`)
  15. }
  16. }