fiex(Login): redirect

feature/artists
mackt 7 months ago
parent b0d8c342ac
commit 445c27c69e

@ -68,7 +68,7 @@ export default function LoginForm({ className }: { className?: string }) {
if (result.code === 200) {
setShowLogin(false);
await getUserInfo();
router.replace(redirect);
if (redirect) router.replace(redirect);
} else {
setErrorText(result.message);
setBtnLoading(false);

@ -1,8 +1,8 @@
import { useSearchParams } from 'next/navigation';
export const useLoginRedirect = () => {
export const useLoginRedirect: () => string | null = () => {
const searchParams = useSearchParams();
const redirect = searchParams.get('redirect');
if (!redirect) return '/';
if (!redirect) return null;
return redirect;
};

Loading…
Cancel
Save