Commit 69453655 authored by janithgamage1.ed's avatar janithgamage1.ed

fix: update

Desc : update project
parent f4a3c366
...@@ -56,15 +56,17 @@ export const JWTProvider = ({ children }: { children: React.ReactElement }) => { ...@@ -56,15 +56,17 @@ export const JWTProvider = ({ children }: { children: React.ReactElement }) => {
const init = async () => { const init = async () => {
try { try {
const serviceToken = window.localStorage.getItem('serviceToken'); const serviceToken = window.localStorage.getItem('serviceToken');
console.log(verifyToken(serviceToken!));
if (serviceToken && verifyToken(serviceToken)) { if (serviceToken && verifyToken(serviceToken)) {
setSession(serviceToken); setSession(serviceToken);
const response = await axios.get('/api/account/me'); // const response = await axios.get('/api/account/me');
const { user } = response.data; // const { user } = response.data;
dispatch({ dispatch({
type: LOGIN, type: LOGIN,
payload: { payload: {
isLoggedIn: true, isLoggedIn: true,
user // user
} }
}); });
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment