mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
3
framework/vendure/auth/index.ts
Normal file
3
framework/vendure/auth/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as useLogin } from './use-login'
|
||||
export { default as useLogout } from './use-logout'
|
||||
export { default as useSignup } from './use-signup'
|
@@ -1,14 +1,15 @@
|
||||
import { useCallback } from 'react'
|
||||
import { MutationHook } from '@commerce/utils/types'
|
||||
import useLogin, { UseLogin } from '@commerce/auth/use-login'
|
||||
import { LoginHook } from '../types/login'
|
||||
import { CommerceError, ValidationError } from '@commerce/utils/errors'
|
||||
import useCustomer from '../customer/use-customer'
|
||||
import { LoginMutation, LoginMutationVariables } from '../schema'
|
||||
import { loginMutation } from '../lib/mutations/log-in-mutation'
|
||||
import { loginMutation } from '../utils/mutations/log-in-mutation'
|
||||
|
||||
export default useLogin as UseLogin<typeof handler>
|
||||
|
||||
export const handler: MutationHook<null, {}, any> = {
|
||||
export const handler: MutationHook<LoginHook> = {
|
||||
fetchOptions: {
|
||||
query: loginMutation,
|
||||
},
|
||||
|
@@ -3,11 +3,12 @@ import { MutationHook } from '@commerce/utils/types'
|
||||
import useLogout, { UseLogout } from '@commerce/auth/use-logout'
|
||||
import useCustomer from '../customer/use-customer'
|
||||
import { LogoutMutation } from '../schema'
|
||||
import { logoutMutation } from '../lib/mutations/log-out-mutation'
|
||||
import { logoutMutation } from '../utils/mutations/log-out-mutation'
|
||||
import { LogoutHook } from '../types/logout'
|
||||
|
||||
export default useLogout as UseLogout<typeof handler>
|
||||
|
||||
export const handler: MutationHook<null> = {
|
||||
export const handler: MutationHook<LogoutHook> = {
|
||||
fetchOptions: {
|
||||
query: logoutMutation,
|
||||
},
|
||||
|
@@ -8,7 +8,8 @@ import {
|
||||
SignupMutation,
|
||||
SignupMutationVariables,
|
||||
} from '../schema'
|
||||
import { signupMutation } from '../lib/mutations/sign-up-mutation'
|
||||
import { signupMutation } from '../utils/mutations/sign-up-mutation'
|
||||
import { SignupHook } from '../types/signup'
|
||||
|
||||
export default useSignup as UseSignup<typeof handler>
|
||||
|
||||
@@ -19,7 +20,7 @@ export type SignupInput = {
|
||||
password: string
|
||||
}
|
||||
|
||||
export const handler: MutationHook<null, {}, SignupInput, SignupInput> = {
|
||||
export const handler: MutationHook<SignupHook> = {
|
||||
fetchOptions: {
|
||||
query: signupMutation,
|
||||
},
|
||||
|
Reference in New Issue
Block a user