Compare commits
4 Commits
@nhost/das
...
@nhost/nex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
257815d519 | ||
|
|
55d8bb5a89 | ||
|
|
18f942f464 | ||
|
|
2a2e54c4d8 |
@@ -24,3 +24,4 @@ NEXT_PUBLIC_ZENDESK_USER_EMAIL=
|
||||
|
||||
CODEGEN_GRAPHQL_URL=https://local.graphql.nhost.run/v1
|
||||
CODEGEN_HASURA_ADMIN_SECRET=nhost-admin-secret
|
||||
NEXT_PUBLIC_TURNSTILE_SITE_KEY=FIXME
|
||||
@@ -1,5 +1,18 @@
|
||||
# @nhost/dashboard
|
||||
|
||||
## 1.29.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 55d8bb5: feat: integrate turnstile for signup verification
|
||||
- 2a2e54c: fix: update docs url in run services form tooltip
|
||||
- 18f942f: fix: display long error messages in error toast without overflow
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@13.0.0
|
||||
- @nhost/nextjs@2.1.22
|
||||
|
||||
## 1.28.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "1.28.2",
|
||||
"version": "1.29.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
@@ -35,6 +35,7 @@
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@marsidev/react-turnstile": "^1.0.2",
|
||||
"@mui/base": "5.0.0-beta.31",
|
||||
"@mui/material": "^5.15.14",
|
||||
"@mui/system": "^5.15.14",
|
||||
|
||||
@@ -112,18 +112,24 @@ export default function ErrorToast({
|
||||
bounce: 0.1,
|
||||
}}
|
||||
>
|
||||
<div className="flex w-full flex-row items-center justify-between space-x-4">
|
||||
<button onClick={close} type="button" aria-label="Close">
|
||||
<div className="flex w-full flex-row items-center justify-between gap-4">
|
||||
<button
|
||||
className="flex-shrink-0"
|
||||
onClick={close}
|
||||
type="button"
|
||||
aria-label="Close"
|
||||
>
|
||||
<XIcon className="h-4 w-4 text-white" />
|
||||
</button>
|
||||
<span>
|
||||
<span className="flex-grow overflow-hidden break-words">
|
||||
{msg ?? 'An unkown error has occured, please try again later!'}
|
||||
</span>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowInfo(!showInfo)}
|
||||
className="flex flex-row items-center justify-center space-x-2 text-white"
|
||||
className="flex flex-shrink-0 flex-row items-center justify-center space-x-2 text-white"
|
||||
aria-label="Show error details"
|
||||
>
|
||||
<span>Info</span>
|
||||
{showInfo ? (
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function ComputeFormSection({
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href="https://docs.nhost.io/run/resources"
|
||||
href="https://docs.nhost.io/guides/run/resources"
|
||||
className="underline"
|
||||
>
|
||||
resources
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function ReplicasFormSection() {
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href="https://docs.nhost.io/run/resources"
|
||||
href="https://docs.nhost.io/guides/run/resources"
|
||||
className="underline"
|
||||
>
|
||||
resources
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Text } from '@/components/ui/v2/Text';
|
||||
import { getToastStyleProps } from '@/utils/constants/settings';
|
||||
import { nhost } from '@/utils/nhost';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { Turnstile } from '@marsidev/react-turnstile';
|
||||
import { styled } from '@mui/material';
|
||||
import { useSignUpEmailPassword } from '@nhost/nextjs';
|
||||
import { useRouter } from 'next/router';
|
||||
@@ -39,6 +40,9 @@ export default function SignUpPage() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
// x-cf-turnstile-response
|
||||
const [turnstileResponse, setTurnstileResponse] = useState(null);
|
||||
|
||||
const form = useForm<SignUpFormValues>({
|
||||
reValidateMode: 'onSubmit',
|
||||
defaultValues: {
|
||||
@@ -66,11 +70,27 @@ export default function SignUpPage() {
|
||||
password,
|
||||
displayName,
|
||||
}: SignUpFormValues) {
|
||||
if (!turnstileResponse) {
|
||||
toast.error(
|
||||
'Please complete the signup verification challenge to continue.',
|
||||
getToastStyleProps(),
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { needsEmailVerification } = await signUpEmailPassword(
|
||||
email,
|
||||
password,
|
||||
{ displayName },
|
||||
{
|
||||
displayName,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'x-cf-turnstile-response': turnstileResponse,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (needsEmailVerification) {
|
||||
@@ -94,7 +114,7 @@ export default function SignUpPage() {
|
||||
Sign Up
|
||||
</Text>
|
||||
|
||||
<Box className="grid grid-flow-row gap-4 rounded-md border bg-transparent p-6 lg:p-12">
|
||||
<Box className="grid grid-flow-row gap-4 p-6 bg-transparent border rounded-md lg:p-12">
|
||||
<Button
|
||||
variant="borderless"
|
||||
className="!bg-white !text-black hover:ring-2 hover:ring-white hover:ring-opacity-50 disabled:!text-black disabled:!text-opacity-60"
|
||||
@@ -122,7 +142,7 @@ export default function SignUpPage() {
|
||||
|
||||
<div className="relative py-2">
|
||||
<Text
|
||||
className="absolute left-0 right-0 top-1/2 mx-auto w-12 -translate-y-1/2 bg-black px-2 text-center text-sm"
|
||||
className="absolute left-0 right-0 w-12 px-2 mx-auto text-sm text-center -translate-y-1/2 bg-black top-1/2"
|
||||
color="disabled"
|
||||
>
|
||||
OR
|
||||
@@ -172,6 +192,12 @@ export default function SignUpPage() {
|
||||
helperText={formState.errors.password?.message}
|
||||
/>
|
||||
|
||||
<Turnstile
|
||||
siteKey={process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY}
|
||||
options={{ theme: 'dark', size: 'flexible' }}
|
||||
onSuccess={setTurnstileResponse}
|
||||
/>
|
||||
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
@@ -188,7 +214,7 @@ export default function SignUpPage() {
|
||||
|
||||
<Divider className="!my-2" />
|
||||
|
||||
<Text color="secondary" className="text-center text-sm">
|
||||
<Text color="secondary" className="text-sm text-center">
|
||||
By signing up, you agree to our{' '}
|
||||
<NavLink
|
||||
href="https://nhost.io/legal/terms-of-service"
|
||||
@@ -212,7 +238,7 @@ export default function SignUpPage() {
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Text color="secondary" className="text-center text-base lg:text-lg">
|
||||
<Text color="secondary" className="text-base text-center lg:text-lg">
|
||||
Already have an account?{' '}
|
||||
<NavLink href="/signin" color="white" className="font-medium">
|
||||
Sign In
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost-examples/cli
|
||||
|
||||
## 0.3.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
|
||||
## 0.3.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/cli",
|
||||
"version": "0.3.11",
|
||||
"version": "0.3.12",
|
||||
"main": "src/index.mjs",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @nhost-examples/codegen-react-apollo
|
||||
|
||||
## 0.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
- @nhost/react-apollo@13.0.0
|
||||
|
||||
## 0.4.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/codegen-react-apollo",
|
||||
"version": "0.4.12",
|
||||
"version": "0.4.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"codegen": "graphql-codegen",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost-examples/codegen-react-query
|
||||
|
||||
## 0.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
|
||||
## 0.4.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/codegen-react-query",
|
||||
"version": "0.4.12",
|
||||
"version": "0.4.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"codegen": "graphql-codegen",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @nhost-examples/react-urql
|
||||
|
||||
## 0.3.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
- @nhost/react-urql@10.0.0
|
||||
|
||||
## 0.3.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/codegen-react-urql",
|
||||
"private": true,
|
||||
"version": "0.3.12",
|
||||
"version": "0.3.13",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost-examples/multi-tenant-one-to-many
|
||||
|
||||
## 2.2.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
|
||||
## 2.2.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/multi-tenant-one-to-many",
|
||||
"private": true,
|
||||
"version": "2.2.12",
|
||||
"version": "2.2.13",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# @nhost-examples/nextjs
|
||||
|
||||
## 0.3.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
- @nhost/react-apollo@13.0.0
|
||||
- @nhost/nextjs@2.1.22
|
||||
|
||||
## 0.3.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/nextjs",
|
||||
"version": "0.3.12",
|
||||
"version": "0.3.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost-examples/node-storage
|
||||
|
||||
## 0.2.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
|
||||
## 0.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/node-storage",
|
||||
"version": "0.2.11",
|
||||
"version": "0.2.12",
|
||||
"private": true,
|
||||
"description": "This is an example of how to use the Storage with Node.js",
|
||||
"main": "src/index.mjs",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost-examples/nextjs-server-components
|
||||
|
||||
## 0.4.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
|
||||
## 0.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/nextjs-server-components",
|
||||
"version": "0.4.13",
|
||||
"version": "0.4.14",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @nhost-examples/react-apollo
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
- @nhost/react-apollo@13.0.0
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/react-apollo",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost-examples/react-gqty
|
||||
|
||||
## 1.2.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
|
||||
## 1.2.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/react-gqty",
|
||||
"private": true,
|
||||
"version": "1.2.12",
|
||||
"version": "1.2.13",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @nhost-examples/react-native
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
- @nhost/react-apollo@13.0.0
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/react-native",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android": "react-native run-android",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @nhost-examples/vue-apollo
|
||||
|
||||
## 0.6.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
- @nhost/apollo@7.1.7
|
||||
- @nhost/vue@2.6.7
|
||||
|
||||
## 0.6.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/vue-apollo",
|
||||
"private": true,
|
||||
"version": "0.6.12",
|
||||
"version": "0.6.13",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost-examples/vue-quickstart
|
||||
|
||||
## 0.2.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/apollo@7.1.7
|
||||
- @nhost/vue@2.6.7
|
||||
|
||||
## 0.2.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/vue-quickstart",
|
||||
"version": "0.2.12",
|
||||
"version": "0.2.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/apollo
|
||||
|
||||
## 7.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
|
||||
## 7.1.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/apollo",
|
||||
"version": "7.1.6",
|
||||
"version": "7.1.7",
|
||||
"description": "Nhost Apollo Client library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @nhost/react-apollo
|
||||
|
||||
## 13.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
- @nhost/apollo@7.1.7
|
||||
|
||||
## 12.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react-apollo",
|
||||
"version": "12.0.6",
|
||||
"version": "13.0.0",
|
||||
"description": "Nhost React Apollo client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost/react-urql
|
||||
|
||||
## 10.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
|
||||
## 9.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react-urql",
|
||||
"version": "9.0.6",
|
||||
"version": "10.0.0",
|
||||
"description": "Nhost React URQL client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"react-dom": "18.2.0",
|
||||
"@graphiql/react": "^0.22.3",
|
||||
"send": "^0.19.0",
|
||||
"dset": "^3.1.4"
|
||||
"dset": "^3.1.4",
|
||||
"rollup": "^4.22.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/hasura-auth-js
|
||||
|
||||
## 2.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 55d8bb5: feat: support custom headers in sign-up and deanonymize requests
|
||||
|
||||
## 2.5.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/hasura-auth-js",
|
||||
"version": "2.5.6",
|
||||
"version": "2.6.0",
|
||||
"description": "Hasura-auth client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
NhostSession,
|
||||
PasswordlessOptions,
|
||||
RequestOptions,
|
||||
SignUpOptions,
|
||||
SignUpSecurityKeyOptions
|
||||
} from '../../types'
|
||||
@@ -23,7 +24,13 @@ export type AuthEvents =
|
||||
options?: PasswordlessOptions
|
||||
}
|
||||
| { type: 'PASSWORDLESS_SMS_OTP'; phoneNumber?: string; otp?: string }
|
||||
| { type: 'SIGNUP_EMAIL_PASSWORD'; email?: string; password?: string; options?: SignUpOptions }
|
||||
| {
|
||||
type: 'SIGNUP_EMAIL_PASSWORD'
|
||||
email?: string
|
||||
password?: string
|
||||
options?: SignUpOptions
|
||||
requestOptions?: RequestOptions
|
||||
}
|
||||
| { type: 'SIGNUP_SECURITY_KEY'; email?: string; options?: SignUpSecurityKeyOptions }
|
||||
| { type: 'SIGNOUT'; all?: boolean }
|
||||
| { type: 'SIGNIN_MFA_TOTP'; ticket?: string; otp?: string }
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
PasswordlessSmsOtpResponse,
|
||||
PasswordlessSmsResponse,
|
||||
RefreshSessionResponse,
|
||||
RequestOptions,
|
||||
SignInAnonymousResponse,
|
||||
SignInMfaTotpResponse,
|
||||
SignInPATResponse,
|
||||
@@ -92,9 +93,10 @@ export const createAuthMachine = ({
|
||||
const postRequest = async <T = any, D = any>(
|
||||
url: string,
|
||||
data?: D,
|
||||
token?: string | null
|
||||
token?: string | null,
|
||||
headers?: Record<string, string>
|
||||
): Promise<T> => {
|
||||
const result = await postFetch<T>(`${backendUrl}${url}`, data, token)
|
||||
const result = await postFetch<T>(`${backendUrl}${url}`, data, token, headers)
|
||||
|
||||
return result.data
|
||||
}
|
||||
@@ -910,13 +912,14 @@ export const createAuthMachine = ({
|
||||
|
||||
return signOutResponse
|
||||
},
|
||||
signUpEmailPassword: async (context, { email, password, options }) => {
|
||||
signUpEmailPassword: async (context, { email, password, options, requestOptions }) => {
|
||||
if (!isValidEmail(email)) {
|
||||
return Promise.reject<SignUpResponse>({ error: INVALID_EMAIL_ERROR })
|
||||
}
|
||||
if (!isValidPassword(password)) {
|
||||
return Promise.reject<SignUpResponse>({ error: INVALID_PASSWORD_ERROR })
|
||||
}
|
||||
|
||||
if (context.user?.isAnonymous) {
|
||||
return postRequest<SignUpResponse>(
|
||||
'/user/deanonymize',
|
||||
@@ -926,14 +929,20 @@ export const createAuthMachine = ({
|
||||
password,
|
||||
options: rewriteRedirectTo(clientUrl, options)
|
||||
},
|
||||
context.accessToken.value
|
||||
context.accessToken.value,
|
||||
requestOptions?.headers
|
||||
)
|
||||
} else {
|
||||
return postRequest<SignUpResponse>('/signup/email-password', {
|
||||
email,
|
||||
password,
|
||||
options: rewriteRedirectTo(clientUrl, options)
|
||||
})
|
||||
return postRequest<SignUpResponse>(
|
||||
'/signup/email-password',
|
||||
{
|
||||
email,
|
||||
password,
|
||||
options: rewriteRedirectTo(clientUrl, options)
|
||||
},
|
||||
null,
|
||||
requestOptions?.headers
|
||||
)
|
||||
}
|
||||
},
|
||||
signUpSecurityKey: async (_, { email, options }) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
||||
import { AuthInterpreter } from '../machines'
|
||||
import { SignUpOptions } from '../types'
|
||||
import { RequestOptions, SignUpOptions } from '../types'
|
||||
|
||||
import {
|
||||
AuthActionLoadingState,
|
||||
@@ -20,13 +20,15 @@ export const signUpEmailPasswordPromise = (
|
||||
interpreter: AuthInterpreter,
|
||||
email: string,
|
||||
password: string,
|
||||
options?: SignUpOptions
|
||||
options?: SignUpOptions,
|
||||
requestOptions?: RequestOptions
|
||||
): Promise<SignUpEmailPasswordHandlerResult> =>
|
||||
new Promise<SignUpEmailPasswordHandlerResult>((resolve) => {
|
||||
const { changed, context } = interpreter.send('SIGNUP_EMAIL_PASSWORD', {
|
||||
email,
|
||||
password,
|
||||
options
|
||||
options,
|
||||
requestOptions
|
||||
})
|
||||
if (!changed) {
|
||||
return resolve({
|
||||
|
||||
@@ -57,3 +57,8 @@ export interface WorkOsOptions extends CommonProviderOptions {
|
||||
provider?: string
|
||||
}
|
||||
export interface ProviderOptions extends CommonProviderOptions, WorkOsOptions {}
|
||||
|
||||
export interface RequestOptions {
|
||||
// optional extra headers to be sent with request (ex: x-cf-turnstile-response)
|
||||
headers?: Record<string, string>
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ if (typeof EdgeRuntime !== 'string') {
|
||||
const fetchWrapper = async <T>(
|
||||
url: string,
|
||||
method: 'GET' | 'POST',
|
||||
{ token, body }: { token?: string | null; body?: any } = {}
|
||||
{
|
||||
token,
|
||||
body,
|
||||
extraHeaders
|
||||
}: { token?: string | null; body?: any; extraHeaders?: HeadersInit } = {}
|
||||
): Promise<FetcResponse<T>> => {
|
||||
const headers: HeadersInit = {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -26,9 +30,12 @@ const fetchWrapper = async <T>(
|
||||
if (token) {
|
||||
headers['Authorization'] = `Bearer ${token}`
|
||||
}
|
||||
|
||||
const mergedHeaders = { ...headers, ...extraHeaders }
|
||||
|
||||
const options: RequestInit = {
|
||||
method,
|
||||
headers
|
||||
headers: mergedHeaders
|
||||
}
|
||||
if (body) {
|
||||
options.body = JSON.stringify(body)
|
||||
@@ -59,8 +66,9 @@ const fetchWrapper = async <T>(
|
||||
export const postFetch = async <T>(
|
||||
url: string,
|
||||
body: any,
|
||||
token?: string | null
|
||||
): Promise<FetcResponse<T>> => fetchWrapper<T>(url, 'POST', { token, body })
|
||||
token?: string | null,
|
||||
extraHeaders?: HeadersInit
|
||||
): Promise<FetcResponse<T>> => fetchWrapper<T>(url, 'POST', { token, body, extraHeaders })
|
||||
|
||||
export const getFetch = <T>(url: string, token?: string | null): Promise<FetcResponse<T>> =>
|
||||
fetchWrapper<T>(url, 'GET', { token })
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost/nextjs
|
||||
|
||||
## 2.1.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/react@3.6.0
|
||||
|
||||
## 2.1.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/nextjs",
|
||||
"version": "2.1.21",
|
||||
"version": "2.1.22",
|
||||
"description": "Nhost NextJS library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost/nhost-js
|
||||
|
||||
## 3.1.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55d8bb5]
|
||||
- @nhost/hasura-auth-js@2.6.0
|
||||
|
||||
## 3.1.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/nhost-js",
|
||||
"version": "3.1.9",
|
||||
"version": "3.1.10",
|
||||
"description": "Nhost JavaScript SDK",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# @nhost/react
|
||||
|
||||
## 3.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 55d8bb5: feat: add `requestOptions` to `signUpEmailPassword` to allow passing extra headers with the signup request
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
|
||||
## 3.5.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react",
|
||||
"version": "3.5.6",
|
||||
"version": "3.6.0",
|
||||
"description": "Nhost React library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {
|
||||
signUpEmailPasswordPromise,
|
||||
SignUpEmailPasswordState,
|
||||
SignUpOptions
|
||||
SignUpOptions,
|
||||
RequestOptions
|
||||
} from '@nhost/nhost-js'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { useAuthInterpreter } from './useAuthInterpreter'
|
||||
@@ -12,7 +13,8 @@ interface SignUpEmailPasswordHandler {
|
||||
(
|
||||
email: string,
|
||||
password: string,
|
||||
options?: SignUpOptions
|
||||
options?: SignUpOptions,
|
||||
requestOptions?: RequestOptions
|
||||
): Promise<SignUpEmailPasswordHandlerResult>
|
||||
}
|
||||
|
||||
@@ -69,8 +71,9 @@ export const useSignUpEmailPassword: SignUpEmailPasswordHook = (options) => {
|
||||
const signUpEmailPassword: SignUpEmailPasswordHandler = (
|
||||
email,
|
||||
password,
|
||||
valueOptions = options
|
||||
) => signUpEmailPasswordPromise(service, email, password as string, valueOptions)
|
||||
valueOptions = options,
|
||||
requestOptions
|
||||
) => signUpEmailPasswordPromise(service, email, password as string, valueOptions, requestOptions)
|
||||
|
||||
const user = useSelector(
|
||||
service,
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/vue
|
||||
|
||||
## 2.6.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.10
|
||||
|
||||
## 2.6.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/vue",
|
||||
"version": "2.6.6",
|
||||
"version": "2.6.7",
|
||||
"description": "Nhost Vue library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
1271
pnpm-lock.yaml
generated
1271
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user