From eae19bb1b047b3568e7a9a624b50e80886e56331 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:47:50 +0300 Subject: feat/frontend: optimizing imports, file extensions (#230) Co-authored-by: FifthWit --- frontend/src/utils/Jwt.tsx | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 frontend/src/utils/Jwt.tsx (limited to 'frontend/src/utils/Jwt.tsx') diff --git a/frontend/src/utils/Jwt.tsx b/frontend/src/utils/Jwt.tsx deleted file mode 100644 index ce351fb..0000000 --- a/frontend/src/utils/Jwt.tsx +++ /dev/null @@ -1,44 +0,0 @@ -// llm ahh funcs -export function get_user_id_from_token(token: string | undefined): string | undefined { - if (!token) { - return undefined; - } - const parts = token.split('.'); - if (parts.length !== 3) { - return undefined; - } - const base64Url = parts[1]; - const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); - - const jsonPayload = decodeURIComponent( - atob(base64) - .split('') - .map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }) - .join('') - ); - return JSON.parse(jsonPayload).sub; -}; - -export function get_user_mod_from_token(token: string | undefined): boolean | undefined { - if (!token) { - return undefined; - } - const parts = token.split('.'); - if (parts.length !== 3) { - return undefined; - } - const base64Url = parts[1]; - const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); - - const jsonPayload = decodeURIComponent( - atob(base64) - .split('') - .map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }) - .join('') - ); - return JSON.parse(jsonPayload).mod; -}; -- cgit v1.2.3