|
@@ -1,10 +1,8 @@
|
|
|
import {useCallback} from "react";
|
|
import {useCallback} from "react";
|
|
|
import { useApolloClient } from "@apollo/client/react";
|
|
import { useApolloClient } from "@apollo/client/react";
|
|
|
import { CUSTOMER_REGISTRATION } from "@/graphql";
|
|
import { CUSTOMER_REGISTRATION } from "@/graphql";
|
|
|
-import {
|
|
|
|
|
- BagistoUser,
|
|
|
|
|
- CreateUserVariables
|
|
|
|
|
-} from "@/types/types";
|
|
|
|
|
|
|
+import {BagistoUser} from "@/types/types";
|
|
|
|
|
+import {RegisterFormData} from "@/types/customer/type";
|
|
|
|
|
|
|
|
interface UserRegisterResult {
|
|
interface UserRegisterResult {
|
|
|
data: BagistoUser | null;
|
|
data: BagistoUser | null;
|
|
@@ -14,10 +12,17 @@ interface UserRegisterResult {
|
|
|
|
|
|
|
|
export const useUserRegister = () => {
|
|
export const useUserRegister = () => {
|
|
|
const client = useApolloClient();
|
|
const client = useApolloClient();
|
|
|
- const userRegister = useCallback((params: CreateUserVariables) => {
|
|
|
|
|
|
|
+ const userRegister = useCallback((params: Omit<RegisterFormData, "isAgree">) => {
|
|
|
return client.mutate({
|
|
return client.mutate({
|
|
|
mutation: CUSTOMER_REGISTRATION,
|
|
mutation: CUSTOMER_REGISTRATION,
|
|
|
- variables: params
|
|
|
|
|
|
|
+ variables: {
|
|
|
|
|
+ input: {
|
|
|
|
|
+ ...params,
|
|
|
|
|
+ status: "1",
|
|
|
|
|
+ isVerified: "1",
|
|
|
|
|
+ isSuspended: "0"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
const resData = res.data?.createCustomer.customer ?? null;
|
|
const resData = res.data?.createCustomer.customer ?? null;
|
|
|
const result: UserRegisterResult = {
|
|
const result: UserRegisterResult = {
|