Skip to content

Commit

Permalink
fix: company save loader on duplicate name error
Browse files Browse the repository at this point in the history
  • Loading branch information
yogesh-gohil committed Dec 1, 2021
1 parent f97868d commit 5c39525
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions resources/scripts/components/modal-components/CompanyModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,27 +211,31 @@ async function submitCompanyData() {
}
isSaving.value = true
const res = await companyStore.addNewCompany(newCompanyForm)
if (res.data.data) {
await companyStore.setSelectedCompany(res.data.data)
if (companyLogoFileBlob && companyLogoFileBlob.value) {
let logoData = new FormData()
logoData.append(
'company_logo',
JSON.stringify({
name: companyLogoName.value,
data: companyLogoFileBlob.value,
})
)
await companyStore.updateCompanyLogo(logoData)
try {
const res = await companyStore.addNewCompany(newCompanyForm)
if (res.data.data) {
await companyStore.setSelectedCompany(res.data.data)
if (companyLogoFileBlob && companyLogoFileBlob.value) {
let logoData = new FormData()
logoData.append(
'company_logo',
JSON.stringify({
name: companyLogoName.value,
data: companyLogoFileBlob.value,
})
)
await companyStore.updateCompanyLogo(logoData)
}
await globalStore.setIsAppLoaded(false)
await globalStore.bootstrap()
closeCompanyModal()
}
await globalStore.setIsAppLoaded(false)
await globalStore.bootstrap()
closeCompanyModal()
isSaving.value = false
} catch {
isSaving.value = false
}
isSaving.value = false
}
function resetNewCompanyForm() {
Expand Down

0 comments on commit 5c39525

Please sign in to comment.