vendor name on header & endpoint issue

This commit is contained in:
Staycie 2024-04-08 18:13:47 +08:00
parent 93c3d89423
commit 2b8d9ddf2a
2 changed files with 21 additions and 9 deletions

View File

@ -397,7 +397,7 @@ if (time() >= $renewal_time) {
created_by: "Sample User",
};
fetch('https://api.obanana.shop/api/v1/payouts/', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/payouts/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -416,7 +416,7 @@ if (time() >= $renewal_time) {
console.log('Payout created successfully');
selectedOrders.forEach(order => {
var orderId = order.orderId;
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',

View File

@ -1,13 +1,23 @@
<?php
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
// $customerData = json_decode($customer_data, true);
// $customer_data = getCustomerbyLoginId($_SESSION["userId"]);
$vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]);
$vendorLoginIdjson = json_decode($vendorLoginId, true);
// var_dump( $vendorLoginIdjson);
if (isset($vendorLoginIdjson['results'][0])) {
$vendorData = $vendorLoginIdjson['results'][0];
$vendorId = $vendorData['_id'];
$_SESSION["LoggedInVendorId"] = $vendorId;
}
if (empty($vendorLoginId)) {
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
}
} else {
$_SESSION["isLoggedIn"] = false;
}
$_SESSION["isLoggedIn"] = false;
}
?>
<?php ?>
@ -163,9 +173,11 @@ if ($_SESSION["userId"] <> "") {
<!-- <button class="text-upper" onclick="displayPopup()">Download App <i aria-hidden="true"></i></button> -->
<?php if(isset($customer_data)) { ?>
<button style="cursor:default;">Hi <span class="text-upper"><?php echo $customer_data[0]['first_name'] ?>!</span></button>
<?php } else { ?>
<?php } else if (isset($vendorData)) {?>
<button style="cursor:default;">Hi <span class="text-upper"><?php echo ($vendorData['user_login']) ?>!</span></button>
<?php } else {?>
<button class="text-upper"><a href="login.php">Login</a></button>
<?php } ?>
<?php } ?>
</div>
<script>