Skip to content

Commit 1013cd7

Browse files
committed
status 대신 code로 unauthorized 판단
1 parent 8a077d2 commit 1013cd7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/fetcher/src/response-handler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export async function handle401Error<SuccessBody, FailureBody>(
5656
return NEED_LOGIN_IDENTIFIER
5757
}
5858

59+
const UNAUTHORIZED_CODE = 'UNAUTHORIZED'
60+
5961
interface ErrorResponse401 {
6062
status: number
6163
code: string
@@ -65,7 +67,7 @@ interface ErrorResponse401 {
6567
export function handleGql401Error(error: GraphQLError) {
6668
if (error.extensions) {
6769
const extensions = error.extensions as unknown as ErrorResponse401
68-
if (extensions.status === 401) {
70+
if (extensions.code === UNAUTHORIZED_CODE) {
6971
return NEED_LOGIN_IDENTIFIER
7072
}
7173
}

0 commit comments

Comments
 (0)