Skip to content

Commit 11cfaa0

Browse files
committed
chore: deploy test (#develop)
1 parent 310e36b commit 11cfaa0

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

services/ahhachul.com/src/apis/request/user.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
import axiosInstance from '@/apis/fetcher';
4-
import type { ApiResponse, UserProfileResponseDto } from '@/types';
4+
import type { ApiResponse, UserFavoriteStations, UserProfileResponseDto } from '@/types';
55
import { getAccessTokenInLocalStorage } from '@/utils/localStorage';
66

77
import { BASE_URL } from '../baseUrl';
@@ -29,11 +29,21 @@ export const prefetchUserProfile = async () => {
2929
};
3030

3131
export const fetchUserFavoriteStations = async () => {
32-
const { data } = await axiosInstance.get<ApiResponse<{ id: 'hello' }>>(
32+
const { data } = await axiosInstance.get<ApiResponse<UserFavoriteStations>>(
3333
'/members/bookmarks/stations',
3434
);
3535

3636
return data;
3737
};
3838

39-
// export const createUserFavoriteStations = () => {}
39+
export const createUserFavoriteStations = (stations: {
40+
stations: {
41+
stationName: string;
42+
label: string;
43+
}[];
44+
}) => {
45+
return axiosInstance.post<ApiResponse<UserFavoriteStations>>(
46+
'/members/bookmarks/stations',
47+
stations,
48+
);
49+
};

services/ahhachul.com/src/services/user.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useQuery } from '@tanstack/react-query';
1+
import { useMutation, useQuery } from '@tanstack/react-query';
22

33
import * as api from '@/apis/request';
44
import { useAuth } from '@/contexts';
@@ -31,5 +31,12 @@ export const useFetchUserFavoriteStations = () => {
3131
queryKey: userKeys.stations(),
3232
enabled: authService.isAuthenticated,
3333
queryFn: api.fetchUserFavoriteStations,
34+
select: res => res.result.stationInfoList,
35+
});
36+
};
37+
38+
export const useCreateUserFavoriteStations = () => {
39+
return useMutation({
40+
mutationFn: api.createUserFavoriteStations,
3441
});
3542
};

services/ahhachul.com/src/types/user.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,17 @@ export interface UserProfileResponseDto {
2020
gender?: Gender;
2121
ageRange?: AgeRange;
2222
}
23+
24+
export interface UserStation {
25+
stationId: number;
26+
stationName: string;
27+
label: string;
28+
subwayLineInfoList: {
29+
subwayLineId: number;
30+
subwayLineName: string;
31+
}[];
32+
}
33+
34+
export interface UserFavoriteStations {
35+
stationInfoList: UserStation[];
36+
}

0 commit comments

Comments
 (0)