map to new back
This commit is contained in:
@@ -6,19 +6,19 @@ import TheMedcards from "@/pages/medcards/TheMedcards";
|
||||
import TheLogin from "@/pages/login/TheLogin";
|
||||
import LoggedInLayout from "@/components/LoggedInLayout";
|
||||
import TheMedicalCard from "@/pages/newMedicalCard/TheMedicalCard";
|
||||
import { fetchWrapper } from "@/shared/fetchWrapper";
|
||||
|
||||
const ifNotAuthenticated = (to, from, next) => {
|
||||
if (!localStorage.getItem("tokenAccess")) {
|
||||
return next();
|
||||
}
|
||||
next("/");
|
||||
const ifNotAuthenticated = async (to, from, next) => {
|
||||
const data = await fetchWrapper.get("users/me");
|
||||
if (!data) return next();
|
||||
return next("/");
|
||||
};
|
||||
|
||||
const ifAuthenticated = (to, from, next) => {
|
||||
if (localStorage.getItem("tokenAccess")) {
|
||||
return next();
|
||||
}
|
||||
next("/login");
|
||||
const ifAuthenticated = async (to, from, next) => {
|
||||
const data = await fetchWrapper.get("users/me");
|
||||
if (!data) return next("/login");
|
||||
|
||||
return next();
|
||||
};
|
||||
|
||||
export default createRouter({
|
||||
|
||||
Reference in New Issue
Block a user