From 84b45cd6b11347e66437cd92dc20372d0abd6eb9 Mon Sep 17 00:00:00 2001 From: Joseph Ditton Date: Wed, 1 Dec 2021 20:18:26 -0700 Subject: adds roles --- client/utils/parse_jwt.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 client/utils/parse_jwt.js (limited to 'client/utils/parse_jwt.js') 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; +}; -- cgit v1.2.3-70-g09d2