Skip to content

Commit

Permalink
Merge pull request #124 from rrafaelc/fix/user-undefined
Browse files Browse the repository at this point in the history
fix: usuario nao autorizado
  • Loading branch information
rrafaelc committed Nov 13, 2023
2 parents d40ce1b + 8853c7b commit 68872c0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/user/getLoggedUserInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { apiUrl } from '../constants/apiUrl.js';
import { serverUrl } from '../constants/serverUrl.js';
import { getAuthorization } from '../utils/getAuthorization.js';

export const getLoggedUseInfo = async () => {
Expand All @@ -13,6 +14,11 @@ export const getLoggedUseInfo = async () => {
},
});

if (!response.ok) {
localStorage.clear();
window.location = `${serverUrl}/login`;
}

const data = await response.json();

return {
Expand Down

0 comments on commit 68872c0

Please sign in to comment.