use jsonResponse & refund back

This commit is contained in:
2024-08-22 13:38:51 +02:00
parent 479183ea13
commit d271e23861
5 changed files with 69 additions and 24 deletions

View File

@ -32,7 +32,7 @@ export function val(api) {
.then(response => response.json())
.then(response => {
console.log(response)
if (response.error === false) {
if (response.ok === true) {
localStorage.setItem("token", response.authentication_token.token);
localStorage.setItem("token_expiry", response.authentication_token.expiry);
showSuccess("login-messages", "Login successful.")
@ -73,7 +73,7 @@ export function forgot(api) {
.then(response => response.json())
.then(response => {
console.log(response)
if (response.error === false) {
if (response.ok === true) {
showSuccess("forgot-messages", "Password reset email sent")
} else {
showError("forgot-messages", response.message)
@ -115,7 +115,7 @@ export function reset(api, email) {
.then(response => response.json())
.then(response => {
console.log(response)
if (response.error === false) {
if (response.ok === true) {
showSuccess("reset-messages", "Password reset")
setTimeout(function () {
location.href = "/login"