Move reset calls to oki-api
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import {useState} from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import axios from 'axios'
|
||||
import Button from '@mui/material/Button'
|
||||
import TextField from '@mui/material/TextField'
|
||||
import Dialog from '@mui/material/Dialog'
|
||||
@@ -10,9 +9,7 @@ import DialogContentText from '@mui/material/DialogContentText'
|
||||
import DialogTitle from '@mui/material/DialogTitle'
|
||||
|
||||
import {validateEmail} from '../../lib/utils/emails'
|
||||
import {jwennUserEpiEmail} from '../../lib/oki-api'
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:1337'
|
||||
import {jwennUserEpiEmail, passwordRequest} from '../../lib/oki-api'
|
||||
|
||||
export default function ResetDialog({lyen, title, activation, content, open, setOpen, setLoading, setError, setSuccess}) {
|
||||
const [email, setEmail] = useState('')
|
||||
@@ -20,9 +17,7 @@ export default function ResetDialog({lyen, title, activation, content, open, set
|
||||
const forgotPasswordRequest = async () => {
|
||||
setLoading(true)
|
||||
try {
|
||||
await axios.post(`${API_URL}/auth/${lyen}`, {
|
||||
email
|
||||
})
|
||||
await passwordRequest(lyen, email)
|
||||
|
||||
if (activation) {
|
||||
const user = await jwennUserEpiEmail(email)
|
||||
|
||||
Reference in New Issue
Block a user