api link to page

This commit is contained in:
2025-11-29 13:00:50 +09:00
parent 32e9fed5cd
commit 39d21a475b
11 changed files with 288 additions and 447 deletions

View File

@@ -4,6 +4,7 @@
import { useEffect, useMemo, useRef, useState } from 'react';
import { useRouter } from 'next/navigation';
import MainLogoSvg from './svgs/mainlogosvg';
import apiService from './lib/apiService';
export default function Home() {
const router = useRouter();
@@ -133,23 +134,13 @@ export default function Home() {
return;
}
const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL
? `${process.env.NEXT_PUBLIC_API_BASE_URL}/auth/me`
: 'https://hrdi.coconutmeet.net/auth/me';
const response = await apiService.getCurrentUser();
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
});
if (!response.ok) {
if (response.status !== 200) {
return;
}
const data = await response.json();
const data = response.data;
if (isMounted) {
// 사용자 권한 확인