diff --git a/lib/api.js b/lib/api.js index 1b308dae..fcd28e79 100644 --- a/lib/api.js +++ b/lib/api.js @@ -1,5 +1,4 @@ import axios from "axios"; -import * as USER from "./user"; const API = axios.create({ baseURL: process.env.NEXT_PUBLIC_API_URL, @@ -209,31 +208,6 @@ export async function isAttendeeRegistered(id) { export async function getCurrentUser() { const response = await API.get("/api/user"); - const { type } = response.data; - - if (type) { - switch (type) { - case USER.ROLES.ATTENDEE: - const { data: attendee } = await API.get("/api/attendee"); - const { - data: { data: extras }, - } = await API.get(`/api/attendees/${attendee.id}`, { - params: { - id: attendee.id, - }, - }); - return { ...attendee, ...extras, type }; - case USER.ROLES.STAFF: - return response.data; - case USER.ROLES.SPONSOR: - const { data: company } = await API.get("/api/company"); - - return { ...company, user_id: response.data.id, type }; - default: - throw new Error(`Unknown USER TYPE: ${type}`); - } - } - return response.data; }