Postgres
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
import { useActionState } from 'react'
|
||||
import { changePasswordAndDisableMustChange } from '../actions'
|
||||
|
||||
export function ForcePasswordChange({ slug }: { slug: string }) {
|
||||
const [state, action, isPending] = useActionState(changePasswordAndDisableMustChange, { success: false, error: '' })
|
||||
const [state, action, isPending] = useActionState(changePasswordAndDisableMustChange, { success: false, error: '', redirectTo: '' })
|
||||
|
||||
useEffect(() => {
|
||||
if (state?.success && state?.redirectTo) {
|
||||
window.location.href = state.redirectTo
|
||||
}
|
||||
}, [state?.success, state?.redirectTo])
|
||||
|
||||
return (
|
||||
<div className="bg-white border rounded-xl p-8 max-w-md w-full shadow-sm">
|
||||
|
||||
Reference in New Issue
Block a user