fix: show 404 on task detail page when the task does not exist (#1014)
This commit is contained in:
parent
f9b31ab4bf
commit
0f3da11bc4
|
|
@ -189,7 +189,13 @@ describe('Task', () => {
|
|||
LabelTaskFactory.truncate()
|
||||
TaskAttachmentFactory.truncate()
|
||||
})
|
||||
it('Shows a 404 page for nonexisting tasks', () => {
|
||||
|
||||
cy.visit('/tasks/9999')
|
||||
|
||||
cy.contains('Not found')
|
||||
.should('be.visible')
|
||||
})
|
||||
it('Shows all task details', () => {
|
||||
const tasks = TaskFactory.create(1, {
|
||||
id: 1,
|
||||
|
|
|
|||
|
|
@ -743,6 +743,13 @@ watch(
|
|||
attachmentStore.set(task.value.attachments)
|
||||
taskColor.value = task.value.hexColor
|
||||
setActiveFields()
|
||||
} catch (e) {
|
||||
if (e?.response?.status === 404) {
|
||||
router.replace({name: 'not-found'})
|
||||
return
|
||||
}
|
||||
|
||||
throw e
|
||||
} finally {
|
||||
await nextTick()
|
||||
scrollToHeading()
|
||||
|
|
|
|||
Loading…
Reference in New Issue