import axios from 'axios'; import { Configuration } from './configuration'; import { Session } from './session'; import { User } from '../types'; export class Auth { static async user(): Promise { const token = Session.bearerToken(); if (!token) return undefined; return axios .get(`${Configuration.resourceServer}/auth/user`, { headers: { Authorization: `Bearer ${sessionStorage.getItem('token')}`, }, }) .then((response) => response.data) .catch(() => undefined); } }