diff options
Diffstat (limited to 'client/utils')
-rw-r--r-- | client/utils/parse_jwt.js | 5 | ||||
-rw-r--r-- | client/utils/roles_context.js | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/client/utils/parse_jwt.js b/client/utils/parse_jwt.js new file mode 100644 index 0000000..38b4bf9 --- /dev/null +++ b/client/utils/parse_jwt.js @@ -0,0 +1,5 @@ +export const parseJwt = (token) => { + if (!token) return {}; + const jwtPayload = JSON.parse(window.atob(token.split('.')[1])); + return jwtPayload; +}; diff --git a/client/utils/roles_context.js b/client/utils/roles_context.js new file mode 100644 index 0000000..089de6a --- /dev/null +++ b/client/utils/roles_context.js @@ -0,0 +1,3 @@ +import { createContext } from 'react'; + +export const RolesContext = createContext({}); |