Skip to content

Commit

Permalink
Merge branch 'compnay-fix' into 'master'
Browse files Browse the repository at this point in the history
fix: company save loader on duplicate name error

See merge request mohit.panjvani/crater-web!1304
  • Loading branch information
mohitpanjwani committed Dec 1, 2021
2 parents f97868d + 5c39525 commit 40f3415
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 40f3415

Please sign in to comment.