mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 19:12:50 +00:00
feat: migrate authentication storage to use js-cookie for improved token management
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Cookies from 'js-cookie';
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import { createRoot, type Root } from 'react-dom/client';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
@@ -138,12 +139,8 @@ export default function UserManagementPage() {
|
||||
style.textContent = UM_OVERRIDES;
|
||||
document.head.appendChild(style);
|
||||
|
||||
const readCookie = (name: string) => {
|
||||
const m = document.cookie.match(new RegExp('(?:^|;\\s*)' + name + '=([^;]*)'));
|
||||
return m ? decodeURIComponent(m[1]) : undefined;
|
||||
};
|
||||
const token = readCookie('ema-backoffice-auth-token') ?? '';
|
||||
const refreshToken = readCookie('ema-backoffice-refresh-token');
|
||||
const token = Cookies.get('ema-backoffice-auth-token') ?? '';
|
||||
const refreshToken = Cookies.get('ema-backoffice-refresh-token');
|
||||
|
||||
const session: UserManagementSessionOptions = {
|
||||
initialSession: token
|
||||
|
||||
Reference in New Issue
Block a user