Working log in/route guard

This commit is contained in:
2025-09-04 08:03:24 -04:00
parent 992a1a217d
commit dc1ee95827
37 changed files with 1283 additions and 1191 deletions

View File

@@ -12,10 +12,17 @@
<div class="xl:col-span-8 space-y-6">
<div class="grid grid-cols-1 xl:grid-cols-12 gap-6">
<ProfileMap
class="xl:col-span-7"
:customer="customer"
/>
<ProfileMap
v-if="customer && customer.customer_latitude != null && customer.customer_longitude != null"
class="xl:col-span-7"
:customer="customer"
/>
<!-- You can add a placeholder for when the map isn't ready -->
<div v-else class="xl:col-span-7 bg-base-100 rounded-lg flex justify-center items-center">
<p class="text-gray-400">Location not available...</p>
</div>
<ProfileSummary
class="xl:col-span-5"
:customer="customer"
@@ -428,18 +435,30 @@ export default defineComponent({
editCard(card_id: any) {
this.$router.push({ name: "cardedit", params: { id: card_id } });
},
removeCard(card_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/payment/card/remove/' + card_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then(() => {
this.getCreditCards(this.customer.user_id)
this.getCreditCardsCount(this.customer.user_id)
notify({ title: "Card Status", text: "Card Removed", type: "Success" });
})
},
removeCard(card_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/payment/card/remove/' + card_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then(() => {
// --- EFFICIENT FIX: Manipulate the local array directly ---
// 1. Filter the 'credit_cards' array to remove the card with the matching id.
this.credit_cards = this.credit_cards.filter(card => card.id !== card_id);
// 2. Decrement the count.
this.credit_cards_count--;
// --- END EFFICIENT FIX ---
notify({ title: "Card Status", text: "Card Removed", type: "Success" });
})
.catch(() => {
notify({ title: "Error", text: "Could not remove card.", type: "error" });
});
},
deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({