Prettier format pending files
This commit is contained in:
parent
020669bb9c
commit
7e8cd6c39f
2 changed files with 40 additions and 11 deletions
|
|
@ -105,7 +105,9 @@ export default function Welcome({
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
// If server returned a manual verification link despite the error, surface it to the user.
|
// If server returned a manual verification link despite the error, surface it to the user.
|
||||||
const manualLink =
|
const manualLink =
|
||||||
typeof payload?.verificationUrl === "string" ? payload.verificationUrl : null;
|
typeof payload?.verificationUrl === "string"
|
||||||
|
? payload.verificationUrl
|
||||||
|
: null;
|
||||||
|
|
||||||
if (manualLink) {
|
if (manualLink) {
|
||||||
setFallbackVerificationLink(manualLink);
|
setFallbackVerificationLink(manualLink);
|
||||||
|
|
@ -118,7 +120,10 @@ export default function Welcome({
|
||||||
} else {
|
} else {
|
||||||
toastError({
|
toastError({
|
||||||
title: "Verification email failed",
|
title: "Verification email failed",
|
||||||
description: payload?.error || payload?.message || "Failed to send verification email",
|
description:
|
||||||
|
payload?.error ||
|
||||||
|
payload?.message ||
|
||||||
|
"Failed to send verification email",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,7 +201,10 @@ export default function Welcome({
|
||||||
// If the client has no active session (common in signup flows), fall back
|
// If the client has no active session (common in signup flows), fall back
|
||||||
// to a server-side check using the admin Supabase client.
|
// to a server-side check using the admin Supabase client.
|
||||||
const isSessionMissing =
|
const isSessionMissing =
|
||||||
(error && ((error.name && error.name.includes("AuthSessionMissing")) || (error.message && error.message.includes("Auth session missing")))) ||
|
(error &&
|
||||||
|
((error.name && error.name.includes("AuthSessionMissing")) ||
|
||||||
|
(error.message &&
|
||||||
|
error.message.includes("Auth session missing")))) ||
|
||||||
false;
|
false;
|
||||||
|
|
||||||
if (isSessionMissing && emailAddress) {
|
if (isSessionMissing && emailAddress) {
|
||||||
|
|
@ -207,10 +215,14 @@ export default function Welcome({
|
||||||
body: JSON.stringify({ email: emailAddress }),
|
body: JSON.stringify({ email: emailAddress }),
|
||||||
});
|
});
|
||||||
|
|
||||||
const payload = await resp.json().catch(() => ({} as any));
|
const payload = await resp.json().catch(() => ({}) as any);
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
const serverMessage =
|
const serverMessage =
|
||||||
payload?.error || payload?.message || (Object.keys(payload || {}).length ? JSON.stringify(payload) : "Server check failed");
|
payload?.error ||
|
||||||
|
payload?.message ||
|
||||||
|
(Object.keys(payload || {}).length
|
||||||
|
? JSON.stringify(payload)
|
||||||
|
: "Server check failed");
|
||||||
console.error("Server check-verification failed", payload);
|
console.error("Server check-verification failed", payload);
|
||||||
toastError({
|
toastError({
|
||||||
title: "Unable to verify",
|
title: "Unable to verify",
|
||||||
|
|
@ -241,7 +253,12 @@ export default function Welcome({
|
||||||
});
|
});
|
||||||
|
|
||||||
// If the server returned a verification link (manual fallback), surface it.
|
// If the server returned a verification link (manual fallback), surface it.
|
||||||
if (payload?.user && payload?.user?.email && payload?.user?.confirmation_sent_at && !payload?.verified) {
|
if (
|
||||||
|
payload?.user &&
|
||||||
|
payload?.user?.email &&
|
||||||
|
payload?.user?.confirmation_sent_at &&
|
||||||
|
!payload?.verified
|
||||||
|
) {
|
||||||
// nothing specific to do here other than logging
|
// nothing specific to do here other than logging
|
||||||
console.debug("User found but not verified", payload.user);
|
console.debug("User found but not verified", payload.user);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,13 @@ export function createServer() {
|
||||||
code: (error as any)?.code || null,
|
code: (error as any)?.code || null,
|
||||||
details: (error as any)?.details || null,
|
details: (error as any)?.details || null,
|
||||||
});
|
});
|
||||||
const errMsg = typeof error === "string" ? error : (error?.message || JSON.stringify(error));
|
const errMsg =
|
||||||
return res.status((error as any)?.status ?? 500).json({ error: errMsg });
|
typeof error === "string"
|
||||||
|
? error
|
||||||
|
: error?.message || JSON.stringify(error);
|
||||||
|
return res
|
||||||
|
.status((error as any)?.status ?? 500)
|
||||||
|
.json({ error: errMsg });
|
||||||
}
|
}
|
||||||
|
|
||||||
const actionLink =
|
const actionLink =
|
||||||
|
|
@ -118,11 +123,18 @@ export function createServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data, error } = await adminSupabase.auth.admin.listUsers({ email });
|
const { data, error } = await adminSupabase.auth.admin.listUsers({
|
||||||
|
email,
|
||||||
|
});
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("[API] listUsers error:", error);
|
console.error("[API] listUsers error:", error);
|
||||||
const errMsg = typeof error === "string" ? error : (error?.message || JSON.stringify(error));
|
const errMsg =
|
||||||
return res.status((error as any)?.status ?? 500).json({ error: errMsg });
|
typeof error === "string"
|
||||||
|
? error
|
||||||
|
: error?.message || JSON.stringify(error);
|
||||||
|
return res
|
||||||
|
.status((error as any)?.status ?? 500)
|
||||||
|
.json({ error: errMsg });
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = (data as any)?.users?.[0] ?? null;
|
const user = (data as any)?.users?.[0] ?? null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue