This commit is contained in:
client perkafean
2024-08-15 07:43:23 +00:00
parent 9c3a14366c
commit 696ac38e33
8 changed files with 333 additions and 59 deletions

View File

@@ -2,7 +2,8 @@ import API_BASE_URL from "../config.js";
// Function to retrieve the authentication token from localStorage
function getAuthToken() {
return localStorage.getItem("auth");
if (localStorage.getItem("auth")) return localStorage.getItem("auth");
return null;
}
// Helper function to get headers with authentication token

View File

@@ -274,7 +274,7 @@ export const handlePaymentFromGuestDevice = async (
// Handle success response
console.log("Transaction successful!");
const data = await response.json();
updateLocalStorage("auth", data.auth);
if (data.newUser) updateLocalStorage("auth", data.auth);
// Optionally return response data or handle further actions upon success
return true;
} else {