Skip to content

Commit

Permalink
feat:useManageTravelData hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ssumanlife committed Oct 22, 2024
1 parent 5c54f2d commit 6d7eae9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/hooks/useManageTravelData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useQuery } from '@tanstack/react-query';
import axios from 'axios';

interface useManageTravelDataPM {
travelId: string;
enabled: boolean;
}

const useManageTravelData = ({ travelId, enabled }: useManageTravelDataPM) => {
return useQuery({
queryKey: ['manageTravel', travelId],
queryFn: async () => {
try {
const res = await axios.get(`/api/v1/travels/manage-my-travel/${travelId}`);
return res.data;
} catch (error) {
console.error('관리할 여행 데이터 로드 실패:', error);
}
},
enabled,
});
};
export default useManageTravelData;

0 comments on commit 6d7eae9

Please sign in to comment.