-
Notifications
You must be signed in to change notification settings - Fork 0
[Client] shopAPI #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Client] shopAPI #56
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
86f2f04
Update item count
frorong 94ae7db
Merge develop
frorong afcaf38
Add queryKeys
frorong 5b488fe
Add itemUrl
frorong 1f44eac
Add useGetItemList
frorong ae3bb04
Add export
frorong 04d5490
Add data
frorong 7514c79
Update queryKeys
frorong 58d1e94
Update urlController
frorong 9701721
Add usePostItemOrder
frorong dcf3583
Update usePostItemOrder
frorong 068d047
Add milidge exception
frorong c7f3704
Update exception
frorong 8776fd8
Update status
frorong 433b7c8
Add studentType
frorong 1680ca0
Update queryKeys
frorong 8d8ea8f
Add urlController
frorong c751938
Add useGetStudentInfo
frorong 3e8b42c
Add myInfo
frorong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| export * from './src'; |
This file contains hidden or 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,3 @@ | ||
| export * from './item'; | ||
| export * from './order'; | ||
| export * from './student'; |
This file contains hidden or 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 @@ | ||
| export * from './useGetItemList'; |
This file contains hidden or 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 @@ | ||
| import { useQuery } from '@tanstack/react-query'; | ||
|
|
||
| import { itemQueryKeys, itemUrl, get } from 'api/common'; | ||
|
|
||
| import type { ShopItemType } from 'types'; | ||
|
|
||
| import type { UseQueryOptions } from '@tanstack/react-query'; | ||
|
|
||
| export const useGetItemList = (options?: UseQueryOptions<ShopItemType[]>) => | ||
| useQuery<ShopItemType[]>( | ||
| itemQueryKeys.getItemList(), | ||
| () => get(itemUrl.itemList()), | ||
| options | ||
| ); |
This file contains hidden or 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 @@ | ||
| export * from './usePostItemOrder'; |
This file contains hidden or 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,16 @@ | ||
| import { useMutation } from '@tanstack/react-query'; | ||
|
|
||
| import { post, orderQueryKeys, orderUrl } from 'api/common'; | ||
|
|
||
| import { AxiosError } from 'axios'; | ||
|
|
||
| interface ItemOrderRequestType { | ||
| itemId: string; | ||
| count: number; | ||
| } | ||
|
|
||
| export const usePostItemOrder = () => | ||
| useMutation<void, AxiosError, ItemOrderRequestType[]>( | ||
| orderQueryKeys.postItem(), | ||
| (orderList) => post(orderUrl.orderItem(), orderList) | ||
| ); |
This file contains hidden or 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 @@ | ||
| export * from './useGetStudentInfo'; |
14 changes: 14 additions & 0 deletions
14
packages/api/client/src/hooks/student/useGetStudentInfo.ts
This file contains hidden or 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 @@ | ||
| import { useQuery } from '@tanstack/react-query'; | ||
|
|
||
| import { studentQueryKeys, studentUrl, get } from 'api/common'; | ||
|
|
||
| import type { StudentType } from 'types'; | ||
|
|
||
| import type { UseQueryOptions } from '@tanstack/react-query'; | ||
|
|
||
| export const useGetStudentInfo = (options?: UseQueryOptions<StudentType>) => | ||
| useQuery<StudentType>( | ||
| studentQueryKeys.getStudentInfo(), | ||
| () => get(studentUrl.studentInfo()), | ||
| options | ||
| ); |
This file contains hidden or 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 @@ | ||
| export * from './hooks'; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| export interface StudentType { | ||
| id: string; | ||
| cumulatePoint: number; | ||
| user: { | ||
| id: string; | ||
| email: string; | ||
| name: string; | ||
| profileImage: string | ''; | ||
| }; | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.