mirror of
https://github.com/franjsco/tick3t
synced 2025-06-05 22:19:18 +02:00
refactor: remove auth module
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
import { validate } from "../api/authentication";
|
|
||||||
|
|
||||||
export const getAuthHeader = () => {
|
|
||||||
const user = JSON.parse(localStorage.getItem("user"));
|
|
||||||
return user && user.token ? `Bearer ${user.token}` : "";
|
|
||||||
};
|
|
||||||
|
|
||||||
export const validateUser = () => {
|
|
||||||
validate().then(json => {
|
|
||||||
if (!json.success) {
|
|
||||||
localStorage.removeItem("user");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const isLogin = () => {
|
|
||||||
if (localStorage.getItem("user")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
Reference in New Issue
Block a user