Skip to content

Commit

Permalink
fix different error handling w/ new api rbac enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Dec 12, 2022
1 parent 6b45ed2 commit 61f9999
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions assets/src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function GrantAccess() {

export function EnsureLogin({ children }) {
const location = useLocation()
const { data, error } = useQuery(ME_Q, { pollInterval: POLL_INTERVAL, errorPolicy: 'ignore' })
const { data, error, loading } = useQuery(ME_Q, { pollInterval: POLL_INTERVAL, errorPolicy: 'ignore' })
const { boot, update } = useIntercom()

useEffect(() => {
Expand All @@ -134,13 +134,13 @@ export function EnsureLogin({ children }) {
if (data && data.me) update()
}, [data, location])

if (error) {
if (error || (!loading && !data.clusterInfo)) {
console.log(error)

return <LoginError error={error} />
}

if (!data) return null
if (!data?.clusterInfo) return null

const { me, externalToken, clusterInfo: { __typename, ...clusterInformation }, configuration } = data

Expand Down

0 comments on commit 61f9999

Please sign in to comment.