fix:
Some checks failed
Format / formatting (push) Successful in 6s
Build / build (push) Successful in 41s
CI / build (push) Failing after 8s
Format / formatting (pull_request) Successful in 6s

This commit is contained in:
Mohamed Maoulainine Maoulainine 2025-04-29 00:00:39 +02:00
parent 8b48a55bf0
commit c3dded1e05

View File

@ -37,23 +37,21 @@ type TokenPayload = {
};
};
function isAdmin(){
function isAdmin(): boolean{
if (store.authenticated && store.user.token) {
try {
const decoded = jwtDecode<TokenPayload>(store.user.token);
const roles = decoded.realm_access?.roles || [];
if (roles.includes("MyINPulse-admin")) {
return true;
} else {
return false;
}
} catch (err) {
console.error("Failed to decode token", err);
} else {
return false;
}
}
}
// this shit made by me so i can run the canva vue app
//createApp(App).use(router).mount('#app');