// src/utils/jwt.ts import dayjs from 'dayjs' import jwtDecode from 'jwt-decode' export interface JwtHeader { alg: string typ: string } export interface JwtToken { exp: number orig_iat: number sub: string scope: string pid: string | undefined } export const decode = (token: string) => ({ header: jwtDecode(token, { header: true }), payload: jwtDecode(token), }) export const getExpire = (token: string) => { const { payload } = decode(token) return dayjs.unix(payload.exp) } export const getJwtTokenObj = (token: string) => { return jwtDecode(token) } export default { getJwtTokenObj, getExpire, decode, }