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

@@ -5,6 +5,7 @@ import { useRouter } from 'next/navigation';
import Link from 'next/link';
import MainLogoSvg from '../svgs/mainlogosvg';
import ChevronDownSvg from '../svgs/chevrondownsvg';
import apiService from '../lib/apiService';
// 아이콘 컴포넌트들
function BookIcon({ className }: { className?: string }) {
@@ -194,30 +195,18 @@ export default function InstructorPage() {
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 === 401) {
localStorage.removeItem('token');
document.cookie = 'token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
if (isMounted) {
router.push('/login');
}
if (response.status === 401) {
localStorage.removeItem('token');
document.cookie = 'token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
if (isMounted) {
router.push('/login');
}
return;
}
const data = await response.json();
const data = response.data;
if (isMounted) {
const role = data.role || data.userRole || '';