atlp-rwanda/hackers-ec-Fe

View on GitHub
src/utils/userDetails.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { jwtDecode } from 'jwt-decode';
import { UserInfoTypes } from '../@types/userType';

const fetchInfo = () => {
    const token: string = localStorage.getItem('access_token') || '';
    try {
        return jwtDecode(token) as UserInfoTypes;
    } catch (error) {
        return null;
    }
};

export default fetchInfo;