mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-13 01:46:23 +01:00
Add controller for reset password API
This commit is contained in:
parent
9e0b499dcc
commit
9831193fe6
1 changed files with 38 additions and 0 deletions
|
@ -79,6 +79,42 @@ function verify_mail(token) {
|
|||
.catch((error) => [error.status, []]);
|
||||
}
|
||||
|
||||
function request_reset_password(email) {
|
||||
let params = new URLSearchParams({
|
||||
email: email,
|
||||
});
|
||||
const conf = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
}
|
||||
};
|
||||
return axios
|
||||
.post(HOST + "/request-reset-password", params, conf)
|
||||
.then((response) => [response.status, response.data])
|
||||
.catch((error) => [error.status, []]);
|
||||
}
|
||||
|
||||
function reset_password(
|
||||
token,
|
||||
password
|
||||
) {
|
||||
let params = new URLSearchParams({
|
||||
password: password,
|
||||
});
|
||||
const conf = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
params: {
|
||||
token: token,
|
||||
}
|
||||
};
|
||||
return axios
|
||||
.post(HOST + "/reset-password", params, conf)
|
||||
.then((response) => [response.status, response.data])
|
||||
.catch((error) => [error.status, []]);
|
||||
}
|
||||
|
||||
function checkout(
|
||||
firstName,
|
||||
lastName,
|
||||
|
@ -142,6 +178,8 @@ module.exports = {
|
|||
register,
|
||||
login,
|
||||
verify_mail,
|
||||
request_reset_password,
|
||||
reset_password,
|
||||
checkout,
|
||||
transaction
|
||||
};
|
Loading…
Reference in a new issue