-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFACTOR: useMutation add and update custom OG simple mode (#116)
Closes #109 #110 ## Description <!-- Describe your implementation plan and approach --> ## Current Tasks <!-- (Optional) List the tasks that you're planning to do in this PR. This is to indicate how much you have been progressing before this PR is ready for review --> - [x] useMutation add new custom OG - [x] useMutation update custom OG
- Loading branch information
1 parent
b00eb7c
commit 9d04224
Showing
3 changed files
with
85 additions
and
30 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
15 changes: 15 additions & 0 deletions
15
src/modules/AccountSettings/SettingOg/hooks/useAddNewCustomOg.ts
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,15 @@ | ||
import { useMutation } from '@tanstack/react-query' | ||
import type { User } from 'firebase/auth' | ||
|
||
import { postAddNewCustomOg } from '@/lib/api' | ||
import type { CreateCustomOgArgs } from '@/lib/types' | ||
|
||
const useAddNewCustomOg = () => { | ||
return useMutation({ | ||
mutationFn: (body: { user: User; params: CreateCustomOgArgs }) => { | ||
return postAddNewCustomOg(body.user, body.params) | ||
}, | ||
}) | ||
} | ||
|
||
export default useAddNewCustomOg |
15 changes: 15 additions & 0 deletions
15
src/modules/AccountSettings/SettingOg/hooks/useUpdatecustomOg.ts
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,15 @@ | ||
import { useMutation } from '@tanstack/react-query' | ||
import type { User } from 'firebase/auth' | ||
|
||
import { patchUpdateCustomOg } from '@/lib/api' | ||
import type { CreateCustomOgArgs } from '@/lib/types' | ||
|
||
const useUpdateCustomOg = () => { | ||
return useMutation({ | ||
mutationFn: (body: { user: User; params: CreateCustomOgArgs }) => { | ||
return patchUpdateCustomOg(body.user, body.params) | ||
}, | ||
}) | ||
} | ||
|
||
export default useUpdateCustomOg |