From a7f832107d19af58b4a0cbbeaddf7f608152dfe3 Mon Sep 17 00:00:00 2001 From: nick Date: Sun, 17 May 2026 19:46:16 +0000 Subject: [PATCH] Use common storage function to save access and refresh tokens --- src/views/Authorization/Authenticating.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/views/Authorization/Authenticating.jsx b/src/views/Authorization/Authenticating.jsx index 693fd4b..ba94fe3 100644 --- a/src/views/Authorization/Authenticating.jsx +++ b/src/views/Authorization/Authenticating.jsx @@ -9,6 +9,7 @@ import { Link, useNavigate, useParams } from 'react-router-dom' import { useUserProfile } from '../../queries/UserQueries' import { apiClient } from '../../utils/ApiClient' import { GetUserProfile } from '../../utils/Fetcher' +import { saveTokens } from '../../utils/TokenStorage' const AuthenticationLoading = () => { const { data: userProfile, refetch: refetchUserProfile } = useUserProfile() @@ -76,9 +77,13 @@ const AuthenticationLoading = () => { }), }).then(response => { if (response.status === 200) { - return response.json().then(data => { - localStorage.setItem('token', data.token) - localStorage.setItem('token_expiry', data.expire) + return response.json().then(async data => { + await saveTokens({ + accessToken: data.token, + accessTokenExpiry: data.expire, + refreshToken: data.refresh_token, + refreshTokenExpiry: data.refresh_token_expiry + }) const redirectUrl = Cookies.get('ca_redirect') if (redirectUrl) {