Fixed remaining ESLint warnings.
This commit is contained in:
parent
7025442d28
commit
d24f484bb2
|
|
@ -1,11 +1,11 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState, useCallback, useEffect } from "react";
|
import { useState, useCallback, useEffect, Suspense } from "react";
|
||||||
import { AUTH } from "@/api/auth/api";
|
import { AUTH } from "@/api/auth/api";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
|
|
||||||
export default function ResetPasswordPage() {
|
function ResetPasswordForm() {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const token = searchParams.get("token");
|
const token = searchParams.get("token");
|
||||||
|
|
||||||
|
|
@ -59,10 +59,11 @@ export default function ResetPasswordPage() {
|
||||||
if (ok && data) {
|
if (ok && data) {
|
||||||
setSuccess(true);
|
setSuccess(true);
|
||||||
} else {
|
} else {
|
||||||
setError(
|
const errorMessage =
|
||||||
(data?.message as string) ||
|
data && typeof data === "object" && "message" in data
|
||||||
"Failed to reset password. Please try again."
|
? (data.message as string)
|
||||||
);
|
: "Failed to reset password. Please try again.";
|
||||||
|
setError(errorMessage);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[token, password, passwordError]
|
[token, password, passwordError]
|
||||||
|
|
@ -228,3 +229,19 @@ export default function ResetPasswordPage() {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default function ResetPasswordPage() {
|
||||||
|
return (
|
||||||
|
<Suspense
|
||||||
|
fallback={
|
||||||
|
<div className="min-h-screen flex items-center justify-center p-4">
|
||||||
|
<div className="text-center" style={{ color: "var(--foreground)" }}>
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ResetPasswordForm />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
Reference in New Issue