Skip to content

Commit

Permalink
fixed date objects for business endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajandeep98 committed Jan 15, 2025
1 parent 05fd506 commit b5d649e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/pages/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const fetchBusinessDetailsWithDelay = async (identifier: string) => {
// Fetch business details and update finalDateString
const slimBusiness = await business.getBusinessDetails(identifier, undefined, true)
const lastModifiedDate = apiToDate(slimBusiness.lastModified)
const initialDate = apiToDate(business.initialDateString)
const initialDate = business.initialDateString
if (lastModifiedDate.getTime() > initialDate.getTime()) {
toast.add({
id: 'outdated_data',
Expand Down
10 changes: 4 additions & 6 deletions src/stores/business.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useBcrosBusiness = defineStore('bcros/business', () => {
const currentParties: Ref<PartiesI> = ref(undefined)

const currentBusinessIdentifier = computed((): string => currentBusiness.value?.identifier)
const initialDateString = ref<string | undefined>(undefined)
const initialDateString = ref<Date | undefined>(undefined)
// set BUSINESS_ID session storage when business identifier is loaded
watch(currentBusinessIdentifier, (value) => {
if (value) {
Expand Down Expand Up @@ -183,10 +183,8 @@ export const useBcrosBusiness = defineStore('bcros/business', () => {
currentBusiness.value = await getBusinessDetails(identifier) || {} as BusinessI

// Converting lastModified values to Date objects
const initialDate = new Date(currentBusiness.value.lastModified)

// truncate milliseconds
initialDateString.value = initialDate.toISOString().split('.')[0]
const initialDate = apiToDate(currentBusiness.value.lastModified)
initialDateString.value = initialDate

if (currentBusiness.value.stateFiling) {
await loadStateFiling()
Expand All @@ -197,7 +195,7 @@ export const useBcrosBusiness = defineStore('bcros/business', () => {

trackUiLoadingStop('businessInfoLoading')

return { initialDateString: initialDateString.value }
return { initialDateString }
}

async function loadBusinessContact (identifier: string, force = false) {
Expand Down

0 comments on commit b5d649e

Please sign in to comment.