Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
aed32ea0
Commit
aed32ea0
authored
Jan 06, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix invalid token redirect
parent
1fb04b96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
useRedirectForInvalidAuthToken.tsx
lib/hooks/useRedirectForInvalidAuthToken.tsx
+3
-9
No files found.
lib/hooks/useRedirectForInvalidAuthToken.tsx
View file @
aed32ea0
...
@@ -3,21 +3,15 @@ import { useQueryClient } from '@tanstack/react-query';
...
@@ -3,21 +3,15 @@ import { useQueryClient } from '@tanstack/react-query';
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
resourceKey
}
from
'
lib/api/resources
'
;
import
{
resourceKey
}
from
'
lib/api/resources
'
;
import
type
{
ResourceError
}
from
'
lib/api/resources
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
useLoginUrl
from
'
lib/hooks/useLoginUrl
'
;
import
useLoginUrl
from
'
lib/hooks/useLoginUrl
'
;
export
interface
ErrorType
{
error
?:
{
status
:
Response
[
'
status
'
];
statusText
:
Response
[
'
statusText
'
];
};
}
export
default
function
useRedirectForInvalidAuthToken
()
{
export
default
function
useRedirectForInvalidAuthToken
()
{
const
queryClient
=
useQueryClient
();
const
queryClient
=
useQueryClient
();
const
state
=
queryClient
.
getQueryState
<
unknown
,
ErrorType
>
([
resourceKey
(
'
user_info
'
)
]);
const
state
=
queryClient
.
getQueryState
<
unknown
,
ResourceError
>
([
resourceKey
(
'
user_info
'
)
]);
const
errorStatus
=
state
?.
error
?.
error
?.
status
;
const
errorStatus
=
state
?.
error
?.
status
;
const
loginUrl
=
useLoginUrl
();
const
loginUrl
=
useLoginUrl
();
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment