Skip to content

Commit

Permalink
fix: badges allow 404
Browse files Browse the repository at this point in the history
  • Loading branch information
shuashuai committed Sep 25, 2024
1 parent db80f63 commit 88dabcc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ui/src/services/client/badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export const useGetAllBadges = () => {
export const useGetBadgeInfo = (id: string) => {
const { data, error, mutate } = useSWR<Type.BadgeInfo, Error>(
`/answer/api/v1/badge?id=${id}`,
request.instance.get,
(url) =>
request.get(url, {
allow404: true,
}),
);
return {
data,
Expand All @@ -51,12 +54,17 @@ export const useGetBadgeInfo = (id: string) => {
};

export const useBadgeDetailList = (params: Type.BadgeDetailListReq) => {
if (!params.badge_id) return { data: null, isLoading: false, error: null };
const { data, error, mutate } = useSWR<Type.BadgeDetailListRes, Error>(
`/answer/api/v1/badge/awards/page?${qs.stringify(params, {
skipNulls: true,
})}`,
request.instance.get,
(url) =>
request.get(url, {
allow404: true,
}),
);

return {
data,
isLoading: !data && !error,
Expand Down

0 comments on commit 88dabcc

Please sign in to comment.