Skip to content

Commit

Permalink
fix: fetch 사용시 나타나는 415 대체로 axios 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
Leejha committed Oct 19, 2023
1 parent b3e1c54 commit 33f066b
Showing 1 changed file with 41 additions and 21 deletions.
62 changes: 41 additions & 21 deletions apps/jurumarble/src/lib/apis/vote.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { authHttpFetch, commonHttpFetch } from 'src/modules/httpFetch';
import { commonHttpFetch } from 'src/modules/httpFetch';
import { VoteSortType } from 'src/types/common';
import { CommonVoteListResponse, Content } from 'src/types/vote';

Expand Down Expand Up @@ -104,18 +104,28 @@ interface ModifyNormalVoteRequest {
}

export const modifyNormalVoteAPI = async (params: ModifyNormalVoteRequest) => {
const response = await authHttpFetch(`api/votes/${params.voteId}/normal`, {
method: 'PUT',
body: JSON.stringify({
title: params.title,
detail: params.detail,
titleA: params.titleA,
titleB: params.titleB,
}),
const response = await http.put(`api/votes/${params.voteId}/normal`, {
title: params.title,
detail: params.detail,
titleA: params.titleA,
titleB: params.titleB,
});
const res = await response.json();
return res.data;

return response.data;
};
// export const modifyNormalVoteAPI = async (params: ModifyNormalVoteRequest) => {
// const response = await authHttpFetch(`api/votes/${params.voteId}/normal`, {
// method: 'PUT',
// body: JSON.stringify({
// title: params.title,
// detail: params.detail,
// titleA: params.titleA,
// titleB: params.titleB,
// }),
// });
// const res = await response.json();
// return res.data;
// };

interface ModifyDrinkVoteRequest {
title: string;
Expand All @@ -126,18 +136,28 @@ interface ModifyDrinkVoteRequest {
}

export const modifyDrinkVoteAPI = async (params: ModifyDrinkVoteRequest) => {
const response = await authHttpFetch(`api/votes/${params.voteId}/drink`, {
method: 'PUT',
body: JSON.stringify({
title: params.title,
detail: params.detail,
drinkAId: params.drinkAId,
drinkBId: params.drinkBId,
}),
const response = await http.put(`api/votes/${params.voteId}/drink`, {
title: params.title,
detail: params.detail,
drinkAId: params.drinkAId,
drinkBId: params.drinkBId,
});
const res = await response.json();
return res.data;

return response.data;
};
// export const modifyDrinkVoteAPI = async (params: ModifyDrinkVoteRequest) => {
// const response = await authHttpFetch(`api/votes/${params.voteId}/drink`, {
// method: 'PUT',
// body: JSON.stringify({
// title: params.title,
// detail: params.detail,
// drinkAId: params.drinkAId,
// drinkBId: params.drinkBId,
// }),
// });
// const res = await response.json();
// return res.data;
// };

export interface PostNormalVoteRequest {
title: string;
Expand Down

0 comments on commit 33f066b

Please sign in to comment.