Skip to content
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

Unknown error #240

Open
meodemsao opened this issue Sep 8, 2022 · 0 comments
Open

Unknown error #240

meodemsao opened this issue Sep 8, 2022 · 0 comments

Comments

@meodemsao
Copy link

meodemsao commented Sep 8, 2022

I using with react-router 6

This my app config

export const AppProvider = ({ children }: AppProviderProps) => {
  return (
    <React.Suspense
      fallback={
        <div className="flex items-center justify-center w-screen h-screen">
          <Spinner size="xl" />
        </div>
      }
    >
      <ErrorBoundary FallbackComponent={ErrorFallback}>
        <HelmetProvider>
          <QueryClientProvider client={queryClient}>
            {process.env.NODE_ENV !== 'test' && <ReactQueryDevtools />}
            <AuthProvider>
              <BrowserRouter>
                <QueryParamProvider
                  adapter={ReactRouter6Adapter}
                  options={{
                    searchStringToObject: parse,
                    objectToSearchString: stringify,
                  }}
                >
                  {children}
                </QueryParamProvider>
              </BrowserRouter>
            </AuthProvider>
          </QueryClientProvider>
        </HelmetProvider>
      </ErrorBoundary>
    </React.Suspense>
  )
}

Example route

import { ContentLayout } from 'components/Layout'
import { AuthActionVerb, AuthPossession } from 'constants/enum/auth'
import { Authorization, useCheckAccess } from 'lib/authorization'

import { RoleCreateComponent } from '../components/RoleCreateComponent'

export const RoleCreate = () => {
  return (
    <ContentLayout title="Create role">
      
        <div className="mt-4">
          <RoleCreateComponent />
        </div>
      
    </ContentLayout>
  )
}

It's work perfect. But if i using

import { ContentLayout } from 'components/Layout'
import { AuthActionVerb, AuthPossession } from 'constants/enum/auth'
import { Authorization, useCheckAccess } from 'lib/authorization'

import { RoleCreateComponent } from '../components/RoleCreateComponent'

export const RoleCreate = () => {
  return (
    <ContentLayout title="Create role">
      <Authorization
        forbiddenFallback={<div>Only admin can view this.</div>}
        persmission={{
          resource: 'role',
          action: AuthActionVerb.CREATE,
          possession: AuthPossession.ANY,
        }}
      >
        <div className="mt-4">
          <RoleCreateComponent />
        </div>
      </Authorization>
    </ContentLayout>
  )
}

or any enum import

import { ContentLayout } from 'components/Layout'
import { AuthActionVerb, AuthPossession } from 'constants/enum/auth'
import { Authorization, useCheckAccess } from 'lib/authorization'

import { RoleCreateComponent } from '../components/RoleCreateComponent'

export const RoleCreate = () => {
	const checkAccess = useCheckAccess({
          resource: 'role',
          action: AuthActionVerb.CREATE,
          possession: AuthPossession.ANY,
        })
  return (
    <ContentLayout title="Create role">
        <div className="mt-4">
          <RoleCreateComponent />
        </div>
     </ContentLayout>
  )
}

I have error like that

Screen Shot 2022-09-08 at 3 28 22 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant