added verify pin API
This commit is contained in:
@@ -3,6 +3,7 @@ import { useMutation } from '@tanstack/react-query'
|
||||
|
||||
import Label from '../Label'
|
||||
import InputText from '../InputText'
|
||||
import { verifyPin } from '../../services/siteServices'
|
||||
|
||||
export default function Pin({step, handleStep, screens}) {
|
||||
|
||||
@@ -17,11 +18,11 @@ export default function Pin({step, handleStep, screens}) {
|
||||
|
||||
const proceed = useMutation({
|
||||
mutationFn: () => {
|
||||
let fields = {pin, ...step.details}
|
||||
let fields = {pin, bvn:step.activeUser.bvn}
|
||||
if(!fields.pin){
|
||||
throw new Error('Please enter pin *')
|
||||
}
|
||||
// return loginUser(fields)
|
||||
return verifyPin(fields)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error)
|
||||
@@ -46,8 +47,8 @@ export default function Pin({step, handleStep, screens}) {
|
||||
<div className='text-input font-semibold w-[70%] mx-auto flex flex-col gap-4 justify-center items-center'>
|
||||
<Label name='Enter your pin' htmlfor='pin' error={error} />
|
||||
<InputText id='pin' name='pin' type='text' value={pin} handleChange={handlePinChange} />
|
||||
{/* <button onClick={()=>{proceed.mutate()}} disabled={proceed.isPending} className='p-3 bg-purple-800 text-base sm:text-xl text-white font-bold rounded'>{proceed.isPending ? 'loading...' : 'Continue'}</button> */}
|
||||
<button onClick={handleContinue} className='p-3 bg-purple-800 text-base sm:text-xl text-white font-bold rounded'>Continue</button>
|
||||
<button onClick={()=>{proceed.mutate()}} disabled={proceed.isPending} className='p-3 bg-purple-800 text-base sm:text-xl text-white font-bold rounded'>{proceed.isPending ? 'loading...' : 'Continue'}</button>
|
||||
{/* <button onClick={handleContinue} className='p-3 bg-purple-800 text-base sm:text-xl text-white font-bold rounded'>Continue</button> */}
|
||||
</div>
|
||||
|
||||
{proceed.error &&
|
||||
|
||||
Reference in New Issue
Block a user