fix error
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable */
|
||||
// Generated by Wrangler by running `wrangler types` (hash: 1aadef19c576560a2c23acd0e7ab9b2e)
|
||||
// Generated by Wrangler by running `wrangler types` (hash: 58c6149f238624e8945df7f87e575516)
|
||||
// Runtime types generated with workerd@1.20251118.0 2025-04-04
|
||||
declare namespace Cloudflare {
|
||||
interface GlobalProps {
|
||||
@@ -9,12 +9,12 @@ declare namespace Cloudflare {
|
||||
CLIENT_ID: "1db63660-063d-4280-b2ea-388aca4a9459";
|
||||
SCOPE: "openid profile email offline_access apps:admin";
|
||||
API_URL: "https://bcs7fgb9og.execute-api.sa-east-1.amazonaws.com";
|
||||
ISSUER_URL: "https://id.saladeaula.digital";
|
||||
MEILI_HOST: "https://search.saladeaula.digital";
|
||||
CLIENT_SECRET: string;
|
||||
REDIRECT_URI: string;
|
||||
SESSION_SECRET: string;
|
||||
MEILI_API_KEY: string;
|
||||
REDIRECT_URI: string;
|
||||
ISSUER_URL: string;
|
||||
}
|
||||
}
|
||||
interface Env extends Cloudflare.Env {}
|
||||
|
||||
@@ -109,7 +109,7 @@ export default function Index({}: Route.ComponentProps) {
|
||||
type: 'manual'
|
||||
})
|
||||
}
|
||||
}, [fetcher.data])
|
||||
}, [fetcher.data, setError])
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Route } from '../+types'
|
||||
|
||||
import { PatternFormat } from 'react-number-format'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { CheckCircle2Icon } from 'lucide-react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { redirect, useFetcher } from 'react-router'
|
||||
@@ -44,7 +44,11 @@ export async function action({ request, context }: Route.ActionArgs) {
|
||||
signal: request.signal
|
||||
})
|
||||
|
||||
throw redirect('/authorize', { headers: r.headers })
|
||||
if (r.ok) {
|
||||
throw redirect('/authorize', { headers: r.headers })
|
||||
}
|
||||
|
||||
return { ok: false, error: await r.json() }
|
||||
}
|
||||
|
||||
export default function Signup({}: Route.ComponentProps) {
|
||||
@@ -63,6 +67,16 @@ export default function Signup({}: Route.ComponentProps) {
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
switch (fetcher.data?.error?.type) {
|
||||
case 'EmailConflictError':
|
||||
return setError('email', {
|
||||
message: 'O endereço de email já está em uso',
|
||||
type: 'manual'
|
||||
})
|
||||
}
|
||||
}, [fetcher.data, setError])
|
||||
|
||||
return (
|
||||
<RegisterContext value={{ user, setUser }}>
|
||||
{user ? (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable */
|
||||
// Generated by Wrangler by running `wrangler types` (hash: 20d12d2cb42a565d117b277533ca85a9)
|
||||
// Generated by Wrangler by running `wrangler types` (hash: 7e2e7bff7e69c3350947dfc5bad66ee7)
|
||||
// Runtime types generated with workerd@1.20251118.0 2025-04-04
|
||||
declare namespace Cloudflare {
|
||||
interface GlobalProps {
|
||||
@@ -7,6 +7,7 @@ declare namespace Cloudflare {
|
||||
}
|
||||
interface Env {
|
||||
ISSUER_URL: "https://58tkjsb308.execute-api.sa-east-1.amazonaws.com";
|
||||
APP_URL: string;
|
||||
}
|
||||
}
|
||||
interface Env extends Cloudflare.Env {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable */
|
||||
// Generated by Wrangler by running `wrangler types` (hash: 46c0a3878ceeb71c97bee6d456de6815)
|
||||
// Generated by Wrangler by running `wrangler types` (hash: c05ef0b4d5ad34d62b7a9ac73fa403af)
|
||||
// Runtime types generated with workerd@1.20251118.0 2025-04-04 nodejs_compat
|
||||
declare namespace Cloudflare {
|
||||
interface GlobalProps {
|
||||
@@ -9,15 +9,15 @@ declare namespace Cloudflare {
|
||||
CLIENT_ID: "1a5483ab-4521-4702-9115-5857ac676851";
|
||||
SCOPE: "openid profile email offline_access";
|
||||
API_URL: "https://bcs7fgb9og.execute-api.sa-east-1.amazonaws.com";
|
||||
ISSUER_URL: "https://id.saladeaula.digital";
|
||||
BUCKET_NAME: "saladeaula.digital";
|
||||
BUCKET_ENDPOINT: "https://s3.sa-east-1.amazonaws.com";
|
||||
MEILI_HOST: "https://search.saladeaula.digital";
|
||||
CLIENT_SECRET: string;
|
||||
REDIRECT_URI: string;
|
||||
SESSION_SECRET: string;
|
||||
MEILI_API_KEY: string;
|
||||
KONVIVA_SECRET_KEY: string;
|
||||
REDIRECT_URI: string;
|
||||
ISSUER_URL: string;
|
||||
}
|
||||
}
|
||||
interface Env extends Cloudflare.Env {}
|
||||
@@ -25,7 +25,7 @@ type StringifyValues<EnvType extends Record<string, unknown>> = {
|
||||
[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
|
||||
};
|
||||
declare namespace NodeJS {
|
||||
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "CLIENT_ID" | "SCOPE" | "API_URL" | "ISSUER_URL" | "BUCKET_NAME" | "BUCKET_ENDPOINT" | "MEILI_HOST" | "CLIENT_SECRET" | "REDIRECT_URI" | "SESSION_SECRET" | "MEILI_API_KEY" | "KONVIVA_SECRET_KEY">> {}
|
||||
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "CLIENT_ID" | "SCOPE" | "API_URL" | "BUCKET_NAME" | "BUCKET_ENDPOINT" | "MEILI_HOST" | "CLIENT_SECRET" | "SESSION_SECRET" | "MEILI_API_KEY" | "KONVIVA_SECRET_KEY" | "REDIRECT_URI" | "ISSUER_URL">> {}
|
||||
}
|
||||
|
||||
// Begin runtime types
|
||||
|
||||
Reference in New Issue
Block a user