-
-
+ setEmail(val.toString())}
+ />
+ setPassword(val.toString())}
+ />
+
Must contain 8 characters with at least 1 uppercase and 1 lowercase letter and either 1 number or 1 special character.
- Create Account
+
+ Create Account
+
diff --git a/src/components/hooks/index.ts b/src/components/hooks/index.ts
index cf83feb42..4a25fd98e 100644
--- a/src/components/hooks/index.ts
+++ b/src/components/hooks/index.ts
@@ -1 +1,3 @@
export { default as useModalCommon } from './useModalCommon'
+export { default as useVerifyCustomer } from './useVerifyCustomer'
+export { default as useSignup } from './useSignup'
diff --git a/src/components/hooks/useSignup.tsx b/src/components/hooks/useSignup.tsx
index b06781e88..91a5fe186 100644
--- a/src/components/hooks/useSignup.tsx
+++ b/src/components/hooks/useSignup.tsx
@@ -22,8 +22,8 @@ const query = gql`
interface SignupInput {
email: string
- firstName: string
- lastName: string
+ firstName?: string
+ lastName?: string
password: string
}
diff --git a/src/components/hooks/useVerifyCustomer.tsx b/src/components/hooks/useVerifyCustomer.tsx
new file mode 100644
index 000000000..edd789d13
--- /dev/null
+++ b/src/components/hooks/useVerifyCustomer.tsx
@@ -0,0 +1,43 @@
+import { LoginMutation } from '@framework/schema'
+import { useState } from 'react'
+import { CommonError } from 'src/domains/interfaces/CommonError'
+import rawFetcher from 'src/utils/rawFetcher'
+import { VERIFY_CUSTOMER_ACCOUNT } from '../../graphql/mutation'
+import useActiveCustomer from './useActiveCustomer'
+
+interface VerifyInput {
+ token: string
+ password?: string
+}
+
+const useVerifyCustomer = () => {
+ const [loading, setLoading] = useState(false)
+ const [error, setError] = useState(null)
+ // const { mutate } = useActiveCustomer()
+
+ const verify = (options: VerifyInput) => {
+ setError(null)
+ setLoading(true)
+ rawFetcher({
+ query: VERIFY_CUSTOMER_ACCOUNT,
+ variables: options,
+ })
+ .then(({ data, headers }) => {
+ console.log("data: ", data)
+ // if (data.login.__typename !== 'CurrentUser') {
+ // throw CommonError.create(data.login.message, data.login.errorCode)
+ // }
+ // const authToken = headers.get('vendure-auth-token')
+ // if (authToken != null) {
+ // localStorage.setItem('token', authToken)
+ // return mutate()
+ // }
+ })
+ .catch(setError)
+ .finally(() => setLoading(false))
+ }
+
+ return { loading, verify, error }
+}
+
+export default useVerifyCustomer
diff --git a/src/graphql/mutation/index.ts b/src/graphql/mutation/index.ts
new file mode 100644
index 000000000..7ea0d4f82
--- /dev/null
+++ b/src/graphql/mutation/index.ts
@@ -0,0 +1 @@
+export * from './user.mutation'
diff --git a/src/graphql/mutation/user.mutation.ts b/src/graphql/mutation/user.mutation.ts
new file mode 100644
index 000000000..a48074ef0
--- /dev/null
+++ b/src/graphql/mutation/user.mutation.ts
@@ -0,0 +1,16 @@
+import { gql } from 'graphql-request'
+
+
+export const VERIFY_CUSTOMER_ACCOUNT = gql`
+mutation verifyCustomerAccount(token: String!, password: String) {
+ verifyCustomerAccount( token: $token, password: $password) {
+ ...on CurrentUser {
+ id
+ identifier
+ }
+ ...ErrorResult
+ }
+}
+`
+
+
diff --git a/src/graphql/query/index.ts b/src/graphql/query/index.ts
new file mode 100644
index 000000000..47c53bc6d
--- /dev/null
+++ b/src/graphql/query/index.ts
@@ -0,0 +1 @@
+// export * from './user.mutation'
diff --git a/src/graphql/query/user.query.ts b/src/graphql/query/user.query.ts
new file mode 100644
index 000000000..e9e7409b4
--- /dev/null
+++ b/src/graphql/query/user.query.ts
@@ -0,0 +1 @@
+// query here
\ No newline at end of file