We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d60f3c4 commit 074b1f9Copy full SHA for 074b1f9
1 file changed
src/features/auth/api/getOauthLink.ts
@@ -0,0 +1,28 @@
1
+import { useMutation } from '@tanstack/react-query'
2
+import { axios } from 'src/lib/axios'
3
+import { MutationConfig } from 'src/lib/react-query'
4
+
5
+type Provider = 'google.com' | 'github.com'
6
7
+export type GetOauthLinkDTO = {
8
+ data: {
9
+ provider: Provider
10
+ state: string
11
+ }
12
+}
13
+const getOauthLink = ({ data }: GetOauthLinkDTO): Promise<{ authLink: string }> => {
14
+ return axios.post('/engine/auth/auth_link', data)
15
16
17
+type QueryFnType = typeof getOauthLink
18
19
+type UseGetArticlesOptions = {
20
+ config?: MutationConfig<QueryFnType>
21
22
23
+export const useGetOauthLink = ({ config }: UseGetArticlesOptions = {}) => {
24
+ return useMutation({
25
+ ...config,
26
+ mutationFn: getOauthLink,
27
+ })
28
0 commit comments