File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed
Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change 11import { axiosInstance } from '@/utils/axios'
22import Cookies from 'js-cookie'
3+ import type { loginDataTypes } from '@/types/auth'
34
4- export const postLogin = async ( nickname : string , password : string ) => {
5- const body = {
6- nickname : nickname ,
7- password : password
8- }
9- const sessionIdValue = '123'
10-
11- const response = await axiosInstance . post ( '/api/auths/login' , body , {
12- headers : {
13- sessionId : sessionIdValue
14- }
5+ export const postLogin = async ( loginData : loginDataTypes , sessionId : string ) => {
6+ const response = await axiosInstance . post ( '/api/auths/login' , loginData , {
7+ headers : { sessionId : sessionId }
158 } )
16-
179 Cookies . set ( 'accessToken' , response . data . accessToken , {
1810 path : '/' ,
1911 sameSite : 'strict'
2012 } )
21-
2213 return response . data
2314}
2415
Original file line number Diff line number Diff line change @@ -12,3 +12,8 @@ export interface User {
1212 memberRole : string
1313 memberStatus : string
1414}
15+
16+ export interface loginDataTypes {
17+ nickname : string
18+ password : string
19+ }
Original file line number Diff line number Diff line change @@ -56,7 +56,12 @@ const password = ref('')
5656
5757const handleLogin = async () => {
5858 try {
59- const res = await postLogin (nickname .value , password .value )
59+ const loginData = {
60+ nickname: nickname .value ,
61+ password: password .value
62+ }
63+ const sessionId = ' 000'
64+ const res = await postLogin (loginData , sessionId )
6065
6166 if (res ) {
6267 switch (res .memberInfo .memberRole ) {
You can’t perform that action at this time.
0 commit comments