-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from SOPT-all/develop
[FEAT] 메인 병합
- Loading branch information
Showing
6 changed files
with
116 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import instance from '@apis/instance'; | ||
|
||
interface OrderResponse { | ||
productId: number; | ||
productImage: string; | ||
detail: string; | ||
price: number; | ||
quantity: number; | ||
} | ||
|
||
interface OrderHistoryResponse { | ||
success: boolean; | ||
data: OrderResponse; | ||
error: string | null; | ||
} | ||
|
||
const fetchOrders = async (): Promise<OrderHistoryResponse> => { | ||
const response = await instance.get<OrderHistoryResponse>(`/api/orders`); | ||
return response.data; | ||
}; | ||
|
||
export default fetchOrders; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import fetchOrders from './getOrders'; | ||
|
||
const useOrders = () => | ||
useQuery({ | ||
queryKey: ['orders'], | ||
queryFn: () => fetchOrders(), | ||
}); | ||
|
||
export default useOrders; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const dummpyOrderHistory = { | ||
success: true, | ||
data: { | ||
productId: 1, | ||
productImage: 'https://ae01.alicdn.com/kf/S709d4d4778ea430c87c0bf0a6574fa8dz.jpg_220x220q75.jpg_.webp', | ||
detail: | ||
'Toocki C타입 to C타입 케이블, 100W PD 고속 충전 충전기, USB C to USB C 디스플레이 케이블, 샤오미 POCO F3 리얼미 맥북 아이패드용', | ||
price: 2700, | ||
quantity: 2, | ||
}, | ||
error: null, | ||
}; | ||
|
||
export default dummpyOrderHistory; |
This file was deleted.
Oops, something went wrong.