use jsonResponse & refund back
This commit is contained in:
		@ -81,7 +81,7 @@ export function checkAuth(api) {
 | 
			
		||||
        fetch(api + "/api/is-authenticated", requestOptions)
 | 
			
		||||
        .then(response => response.json())
 | 
			
		||||
            .then(function(data) {
 | 
			
		||||
                if (data.error === true) {
 | 
			
		||||
                if (data.ok === false) {
 | 
			
		||||
                    console.log("not logged in");
 | 
			
		||||
                    location.href = "/login"
 | 
			
		||||
                } else {
 | 
			
		||||
 | 
			
		||||
@ -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"
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user