import Alert from '@/core/components/elements/Alert/Alert' import SimpleFooter from '@/core/components/elements/Footer/SimpleFooter' import Link from '@/core/components/elements/Link/Link' import BasicLayout from '@/core/components/layouts/BasicLayout' import DesktopView from '@/core/components/views/DesktopView' import MobileView from '@/core/components/views/MobileView' import Image from 'next/image' import { useRouter } from 'next/router' import { useRef, useState } from 'react' import IndoteknikLogo from '@/images/logo.png' import odooApi from '@/core/api/odooApi' import { setAuth } from '@/core/utils/auth' export default function ResetPassword() { return ( <>
) } const FormComponent = () => { const router = useRouter() const { token = '' } = router.query const password = useRef(null) const retypePassword = useRef(null) const [isLoading, setIsLoading] = useState(false) const [isValidPassword, setIsValidPassword] = useState(false) const [alert, setAlert] = useState(null) const checkValidPassword = () => { const passwordVal = password.current.value const retypePasswordVal = retypePassword.current.value if (passwordVal && passwordVal == retypePasswordVal) { setIsValidPassword(true) } else { setIsValidPassword(false) } } const resetPasswordRequest = async (e) => { e.preventDefault() setIsLoading(true) const result = await odooApi('POST', '/api/v1/user/reset-password', { token, password: password.current.value }) setIsLoading(false) password.current.value = '' retypePassword.current.value = '' if (result.success) { setAuth(result.user) setAlert({ children: ( <> Berhasil melakukan reset password,{' '} kembali ke halaman utama ), type: 'success' }) } else { setAlert({ children: ( <> Gagal melakukan reset password, token tidak ditemukan. Buat permintaan reset password{' '} disini ), type: 'info' }) } } return (
Logo Indoteknik

Reset Kata Sandi Akun Indoteknik

{alert && ( {alert.children} )}
) }