Skip to content

Commit b1e6aca

Browse files
Merge pull request #7442 from theoholl/redirect-after-deleting-board
Redirect user to overview page after deleting or leaving a board
2 parents 7986cfb + 2079400 commit b1e6aca

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/components/navigation/AppNavigationBoard.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ export default {
334334
.then(() => {
335335
this.loading = false
336336
this.deleted = true
337+
this.redirectToOverviewIfCurrentBoard()
337338
this.undoTimeoutHandle = setTimeout(() => {
338339
this.$store.dispatch('removeBoard', this.board)
339340
}, 7000)
@@ -359,6 +360,7 @@ export default {
359360
this.boardApi.leaveBoard(this.board)
360361
.then(() => {
361362
this.loading = false
363+
this.redirectToOverviewIfCurrentBoard()
362364
this.$store.dispatch('removeBoard', this.board)
363365
})
364366
.catch(() => {
@@ -436,6 +438,12 @@ export default {
436438
}
437439
}
438440
},
441+
redirectToOverviewIfCurrentBoard() {
442+
const currentBoardId = Number.parseInt(this.$route?.params?.id, 10)
443+
if (!Number.isNaN(currentBoardId) && currentBoardId === this.board.id) {
444+
this.$router.push({ name: 'main' })
445+
}
446+
},
439447
},
440448
}
441449
</script>

0 commit comments

Comments
 (0)