Fix customer portal not reflecting company default currency

The customer portal bootstrap now returns current_company_currency
alongside the customer's own currency. The store falls back to the
company currency when the customer has no currency assigned.

Fixes #142
This commit is contained in:
Darko Gjorgjijoski
2026-04-06 23:37:56 +02:00
parent c46118be3b
commit 9638e02eb8
2 changed files with 5 additions and 1 deletions

View File

@@ -77,6 +77,7 @@ export interface CustomerPortalBootstrapMeta {
menu: CustomerPortalMenuItem[]
modules: string[]
current_customer_currency?: Currency | null
current_company_currency?: Currency | null
current_company_language?: string
}
@@ -280,7 +281,7 @@ export const useCustomerPortalStore = defineStore('customerPortal', {
this.currentUser = data.data
this.mainMenu = data.meta.menu ?? []
this.currency = data.data.currency ?? data.meta.current_customer_currency ?? null
this.currency = data.data.currency ?? data.meta.current_customer_currency ?? data.meta.current_company_currency ?? null
this.enabledModules = data.meta.modules ?? []
this.currentCompanyLanguage = data.meta.current_company_language ?? 'en'
this.userForm = hydrateUserForm(data.data)