Skip to content

Commit decb352

Browse files
committed
doc: add comment for handling the logout promise resolution
1 parent c99441d commit decb352

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Common/Api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ async function fetchAPI<K = object>(
150150
})
151151
} else {
152152
handleLogout()
153+
// Using this way to ensure that the user is redirected to the login page
154+
// and the component has enough time to get unmounted otherwise the component re-renders
155+
// and try to access some property of a variable and log exception to sentry
153156
return await new Promise((resolve) => {
154157
setTimeout(() => {
155158
resolve({ code: 401, status: 'Unauthorized', result: [] })

0 commit comments

Comments
 (0)