From 816f32df1989d7582943001e0e0ea4f048dcbeaa Mon Sep 17 00:00:00 2001 From: muhammadeko Date: Fri, 6 May 2022 23:53:55 +0700 Subject: [PATCH] fix --- src/components/pages/GCAuth.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/pages/GCAuth.tsx b/src/components/pages/GCAuth.tsx index da176f0..2665290 100644 --- a/src/components/pages/GCAuth.tsx +++ b/src/components/pages/GCAuth.tsx @@ -99,6 +99,10 @@ export default function GCAuth() { try { let resJson = JSON.parse(resText); if (resJson.success) { + setJwt(resJson.jwt); + const splitToken = resJson.jwt.split("."); + const payload = JSON.parse(atob(splitToken[1])); + setToken(payload.token); await Swal.fire({ toast: true, position: "top-end", @@ -108,10 +112,6 @@ export default function GCAuth() { title: "Login success", icon: "success" }); - setJwt(resJson.jwt); - const splitToken = resJson.jwt.split("."); - const payload = JSON.parse(atob(splitToken[1])); - setToken(payload.token); } else { await Swal.fire({ title: "Login failed",