Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api/photographer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const checkPhotographerExistence = async (nickname: string) =>
`/photographers/nicknames/existence?nickname=${nickname}`
);

export const getPhotographerList = async (params: string) =>
export const getPhotographerList = async (params: URLSearchParams) =>
await GET<PaginatedResponse<PhotographerListItem>>(
`/photographers/list?${params}`,
`/photographers/list?${params.toString()}`,
localStorage.getItem("accessToken") ? true : false
);

Expand Down
4 changes: 2 additions & 2 deletions src/api/promotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { GET, PUT, POST, DELETE } from "../utils/axios";
import { PromotionBody, PromotionDetail, PromotionListItem } from "../types/promotion";
import { PaginatedResponse } from "../types/common";

export const getPromotionList = async (params: string) =>
export const getPromotionList = async (params: URLSearchParams) =>
await GET<PaginatedResponse<PromotionListItem>>(
`/promotions/list?${params}`,
`/promotions/list?${params.toString()}`,
localStorage.getItem("accessToken") ? true : false
);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePhotographerList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function usePhotographerList(params: string, enabled = true) {
let cancelled = false;
setIsLoading(true);
setError(null);
getPhotographerList(params)
getPhotographerList(new URLSearchParams(params))
.then((res) => {
if (!cancelled) setPhotographers(res.items);
})
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePromotionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function usePromotionList(params: string, enabled = true) {
let cancelled = false;
setIsLoading(true);
setError(null);
getPromotionList(params)
getPromotionList(new URLSearchParams(params))
.then((res) => {
if (!cancelled) setPromotions(res.items);
})
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SearchPage/Photographers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Photographers({ data, searchKeyword }: Props) {
const p = new URLSearchParams(searchParams);
p.set("searchKeyword", searchKeyword);
try {
const res = await getPhotographerList(p.toString());
const res = await getPhotographerList(p);
setPhotographerList(res.items);
} catch (e) {
console.log(e);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SearchPage/Promotions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Promotions({ data, searchKeyword }: Props) {
const p = new URLSearchParams(searchParams);
p.set("searchKeyword", searchKeyword);
try {
const res = await getPromotionList(p.toString());
const res = await getPromotionList(p);
setPromotionList(res.items);
} catch (e) {
console.log(e);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/SearchPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export default function SearchPage() {

const isOverview = state === "OVERVIEW" && !!searchKeyword;
const { promotions: promotionList } = usePromotionList(
`searchKeyword=${searchKeyword}`,
new URLSearchParams({ searchKeyword }).toString(),
isOverview
);
const { photographers: photographerList } = usePhotographerList(
`searchKeyword=${searchKeyword}`,
new URLSearchParams({ searchKeyword }).toString(),
isOverview
);

Expand Down
Loading