diff --git a/frontend/src/hooks/api/useAuth.js b/frontend/src/hooks/api/useAuth.js index 1d759f4..d7a928f 100644 --- a/frontend/src/hooks/api/useAuth.js +++ b/frontend/src/hooks/api/useAuth.js @@ -15,11 +15,15 @@ export function useAuth() { return instance .post(`${API_URL}/user/login`, formData) .then(({ data, config }) => { - const { 'access-token': accessToken } = data; + const { role: role, 'access-token': accessToken } = data; config.headers.Authorization = `${accessToken}`; setToken(accessToken); - // TODO: userType 구분 추가 - setUserType('student'); + + if (role === 'ADMIN') { + setUserType('teacher'); + } else if (role === 'STUDENT') { + setUserType('student'); + } }) .catch((e) => { alert('아이디 또는 비밀번호를 다시 확인해주세요.');