Browse Source

feat: implement cookie handling for HABIB_TOKEN and HABIB_COINS in AuthBridge and update request headers

master
mortezaei 2 months ago
parent
commit
d93b626ec6
  1. 12
      src/app/layout.tsx

12
src/app/layout.tsx

@ -68,8 +68,16 @@ export default function RootLayout({
}
function readCookie(name) {
var match = document.cookie.match(new RegExp('(?:^|; )' + name.replace(/[.*+?^${}()|[\\]\\]/g, '\\\\$&') + '=([^;]*)'));
return match ? decodeURIComponent(match[1]) : '';
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0; i < cookies.length; i += 1) {
var parts = cookies[i].split('=');
if (parts[0] === name) {
return decodeURIComponent(parts.slice(1).join('='));
}
}
return '';
}
if (!Object.getOwnPropertyDescriptor(window, 'HABIB_TOKEN')) {

Loading…
Cancel
Save