PHP Classes

File: frontend/js/componentes/models/adminModel.js

Recommend this page to a friend!
  Classes of Rodrigo Faustino   Livraria   frontend/js/componentes/models/adminModel.js   Download  
File: frontend/js/componentes/models/adminModel.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Livraria
Manage a bookstore using micro-services
Author: By
Last change:
Date: 2 months ago
Size: 333 bytes
 

Contents

Class file image Download
export function isAdmin() { const token = localStorage.getItem('token'); if (!token) return false; try { const payload = JSON.parse(atob(token.split('.')[1])); return payload.data.role === 'admin'; } catch (error) { console.error('Token parsing error:', error); return false; } }