File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
routes/session/$sessionId Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -9,18 +9,16 @@ import {
9
9
PostRefreshResponseSchema ,
10
10
} from '@/features/auth/auth.dto' ;
11
11
12
- const AUTH_BASE_URL = '/api/auth' ;
13
-
14
12
export const login = ( body : PostLoginRequestDTO ) =>
15
13
axios
16
- . post < PostLoginResponseDTO > ( `${ AUTH_BASE_URL } /login` , PostLoginRequestSchema . parse ( body ) )
14
+ . post < PostLoginResponseDTO > ( `/api/auth /login` , PostLoginRequestSchema . parse ( body ) )
17
15
. then ( ( res ) => PostLoginResponseSchema . parse ( res . data ) ) ;
18
16
19
- export const logout = ( ) => axios . post ( `${ AUTH_BASE_URL } /logout` ) ;
17
+ export const logout = ( ) => axios . post ( `/api/auth /logout` ) ;
20
18
21
19
export const refresh = ( ) =>
22
20
axios
23
- . post < PostRefreshResponseDTO > ( `${ AUTH_BASE_URL } /token` , undefined , {
21
+ . post < PostRefreshResponseDTO > ( `/api/auth /token` , undefined , {
24
22
withCredentials : true ,
25
23
} )
26
24
. then ( ( res ) => PostRefreshResponseSchema . parse ( res . data ) ) ;
Original file line number Diff line number Diff line change 1
1
import { createFileRoute , redirect } from '@tanstack/react-router' ;
2
+ import { useEffect } from 'react' ;
2
3
3
4
import { refresh , useAuthStore } from '@/features/auth' ;
4
5
import { getSessionToken , useSessionStore } from '@/features/session' ;
@@ -7,8 +8,18 @@ import { getQuestions } from '@/features/session/qna';
7
8
8
9
import { QuestionList } from '@/components' ;
9
10
11
+ function SessionComponent ( ) {
12
+ const { sessionTitle } = useSessionStore ( ) ;
13
+
14
+ useEffect ( ( ) => {
15
+ if ( sessionTitle ) document . title = `Ask-It - ${ sessionTitle } ` ;
16
+ } , [ sessionTitle ] ) ;
17
+
18
+ return < QuestionList /> ;
19
+ }
20
+
10
21
export const Route = createFileRoute ( '/session/$sessionId/' ) ( {
11
- component : QuestionList ,
22
+ component : SessionComponent ,
12
23
beforeLoad : async ( { params : { sessionId } } ) => {
13
24
const {
14
25
reset,
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ test('회원 가입이 이미 중복된 닉네임이 있어서 실패하는 경
128
128
await expect ( signUpButton ) . toBeDisabled ( ) ;
129
129
} ) ;
130
130
131
- test ( '로그인 / 로그아웃 플로우 전체 테스트' , async ( { page } ) => {
131
+ test ( '로그인 플로우 전체 테스트' , async ( { page } ) => {
132
132
await page . click ( 'text=로그인' ) ;
133
133
134
134
const loginButton = page . getByRole ( 'button' , { name : '로그인' } ) . nth ( 1 ) ;
@@ -151,7 +151,4 @@ test('로그인 / 로그아웃 플로우 전체 테스트', async ({ page }) =>
151
151
expect ( ( await response ) . status ( ) ) . toBe ( 200 ) ;
152
152
153
153
await expect ( page . locator ( 'text=로그인 되었습니다.' ) ) . toBeVisible ( ) ;
154
-
155
- await page . click ( 'text=로그아웃' ) ;
156
- await expect ( page . locator ( 'text=로그아웃 되었습니다.' ) ) . toBeVisible ( ) ;
157
154
} ) ;
You can’t perform that action at this time.
0 commit comments