import AuthService from '@/service/AuthService';

const { API_URL, authFetch, readErrorMessage } = AuthService;

async function getCurrentUser() {
    const res = await authFetch(`${API_URL}/api/identity/me`, { method: 'GET' });
    if (!res.ok) {
        throw new Error(await readErrorMessage(res));
    }
    return res.json();
}

export default {
    getCurrentUser
};
