Skip to content
15 changes: 15 additions & 0 deletions src/api/auth/login.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import axios from 'axios';
import { AUTH_URL } from '@/constants/urls';

export default async function handleLogin(email: string, password: string) {
try {
const response = await axios.post(`${AUTH_URL}/login`, { email, password });
const { accessToken } = response.data;

localStorage.setItem('accessToken', accessToken);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋กœ์ปฌ์Šคํ† ๋ฆฌ์ง€๋ฅผ ์‚ฌ์šฉํ•˜์…จ๋Š”๋ฐ ์™œ ์‚ฌ์šฉํ•˜์…จ๋‚˜์š”?
๋กœ๊ทธ์ธ์š”์ฒญํ›„ ์‘๋‹ต ๋ฐ›์„๋•Œ accessToken์ด ์–ด๋””์— ์ €์žฅ๋˜๋Š”์ง€ ํ™•์ธํ•˜์…จ๋‚˜์š”?
์ €ํฌ ์ „์—ญ ์ƒํƒœ ๊ด€๋ฆฌ๋Š” zustand ์‚ฌ์šฉํ•˜๊ธฐ๋กœ ํ–ˆ์œผ๋‹ˆ zustand๋กœ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ ค์š”.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zustand๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋‹ค์‹œ ์ˆ˜์ •ํ•˜๊ฒŸ์Šต๋‹ˆ๋‹ค

return true;
} catch (error) {
console.error('๋กœ๊ทธ์ธ ์‹คํŒจ:', error);
return false;
}
}
Empty file added src/api/auth/signup.ts
Empty file.