-
Notifications
You must be signed in to change notification settings - Fork 174
Refactor permission check redirect #2109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b4c9c92
b640a07
fc8f274
e643efe
1115a4b
b5e9a05
5115097
7f0e663
f50a9e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,10 @@ | ||||||||
| import { PopulatedFlow } from '@openops/shared'; | ||||||||
| import { Permission, PopulatedFlow } from '@openops/shared'; | ||||||||
| import { useQuery } from '@tanstack/react-query'; | ||||||||
| import { useEffect } from 'react'; | ||||||||
| import { Navigate, useParams, useSearchParams } from 'react-router-dom'; | ||||||||
|
|
||||||||
| import { FullPageSpinner } from '@/app/common/components/full-page-spinner'; | ||||||||
| import { useCheckAccessAndRedirect } from '@/app/common/hooks/authorization-hooks'; | ||||||||
| import { QueryKeys } from '@/app/constants/query-keys'; | ||||||||
| import { SEARCH_PARAMS } from '@/app/constants/search-params'; | ||||||||
| import { BuilderPage } from '@/app/features/builder'; | ||||||||
|
|
@@ -15,6 +16,7 @@ import { flowsApi } from '@/app/features/flows/lib/flows-api'; | |||||||
| import { AxiosError } from 'axios'; | ||||||||
|
|
||||||||
| const FlowBuilderPage = () => { | ||||||||
| const hasAccess = useCheckAccessAndRedirect(Permission.READ_FLOW); | ||||||||
| const { flowId } = useParams(); | ||||||||
| const [searchParams, setSearchParams] = useSearchParams(); | ||||||||
|
|
||||||||
|
|
@@ -51,6 +53,10 @@ const FlowBuilderPage = () => { | |||||||
| refetchOnWindowFocus: 'always', | ||||||||
|
||||||||
| refetchOnWindowFocus: 'always', | |
| refetchOnWindowFocus: 'always', | |
| enabled: Boolean(hasAccess && flowId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need it? In theory it is not reachable as user will be redirected. But we can keep it to be more confident
Uh oh!
There was an error while loading. Please reload this page.