Skip to content

Commit

Permalink
Merge pull request #325 from MerginMaps/gh#261-handle-error-method
Browse files Browse the repository at this point in the history
Add method to handle push error
  • Loading branch information
MarcelGeo authored Nov 13, 2024
2 parents 777e0b6 + 931054c commit c555cf1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions web-app/packages/lib/src/modules/project/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,11 @@ export const useProjectStore = defineStore('projectModule', {
},

async pushProjectChanges(payload) {
const notificationStore = useNotificationStore()

const { data, projectPath } = payload
try {
return await ProjectApi.pushProjectChanges(projectPath, data)
} catch (err) {
await notificationStore.error({ text: getErrorMessage(err, 'Error') })
await this.handlePushError(err)
return undefined
}
},
Expand Down Expand Up @@ -833,6 +831,13 @@ export const useProjectStore = defineStore('projectModule', {
this.versionsChangesetLoading = false
}
return response?.data
},

async handlePushError(err: unknown) {
const notificationStore = useNotificationStore()
await notificationStore.error({
text: getErrorMessage(err, 'Failed to push changes')
})
}
}
})

0 comments on commit c555cf1

Please sign in to comment.