diff --git a/components/Badge/index.tsx b/components/Badge/index.tsx index c83a81e5..22cb924e 100644 --- a/components/Badge/index.tsx +++ b/components/Badge/index.tsx @@ -39,18 +39,18 @@ const Badge: React.FC = ({
{!badgeLoaded && } - {badge404 && - {name} - } + {badge404 && ( + {name} + )} {name} setBadgeLoaded(true)} - onError={() => { setBadge404(true); setBadgeLoaded(true); }} + onError={() => { + setBadge404(true); + setBadgeLoaded(true); + }} hidden={!badgeLoaded || badge404} />
diff --git a/context/Auth/AuthContext.tsx b/context/Auth/AuthContext.tsx index 1c3b0a40..ef861ac8 100644 --- a/context/Auth/AuthContext.tsx +++ b/context/Auth/AuthContext.tsx @@ -101,7 +101,6 @@ export function AuthProvider({ children }) { useEffect(() => { if (user) { - console.log(user); setAuthenticated(true); } else { setAuthenticated(false); 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; }