You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app-redirection.ts 681B

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