Skip to content

Commit 7a573d1

Browse files
committed
fix: correctly handle upcoming url path
Signed-off-by: grnd-alt <git@belakkaf.net>
1 parent 9802d8f commit 7a573d1

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

appinfo/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
return [
99
'routes' => [
1010
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
11+
['name' => 'page#indexUpcoming', 'url' => '/upcoming', 'verb' => 'GET'],
1112
['name' => 'page#indexList', 'url' => '/board', 'verb' => 'GET'],
1213
['name' => 'page#indexBoard', 'url' => '/board/{boardId}', 'verb' => 'GET'],
1314
['name' => 'page#indexBoardDetails', 'url' => '/board/{boardId}/details', 'verb' => 'GET'],

lib/Controller/PageController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ public function indexCard(int $cardId): TemplateResponse {
107107
return $this->index();
108108
}
109109

110+
#[NoAdminRequired]
111+
#[NoCSRFRequired]
112+
public function indexUpcoming(): TemplateResponse {
113+
return $this->index();
114+
}
115+
110116
#[NoAdminRequired]
111117
#[NoCSRFRequired]
112118
public function redirectToCard($cardId): RedirectResponse {

src/components/navigation/AppNavigation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:exact="true"
1111
to="/upcoming">
1212
<template #icon>
13-
<CalendarIcon v-if="$route.path === '/'" :size="20" />
13+
<CalendarIcon v-if="$route.path === '/upcoming'" :size="20" />
1414
<CalendarOutlineIcon v-else :size="20" />
1515
</template>
1616
</NcAppNavigationItem>

src/router.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,23 @@ const router = new Router({
154154
})
155155

156156
router.beforeEach((to, from, next) => {
157-
// Redirect if fullPath begins with a hash (ignore hashes later in path)
158-
if (to.hash.substring(0, 2) === '#/') {
159-
const path = to.fullPath.replace('/#/', '/').trimEnd('/')
160-
next(path)
161-
return
162-
}
163157
// Redirect to the pinned default board if set and navigating to the main route
164158
if (to.name === 'main') {
165159
const defaultBoardId = localStorage.getItem('deck.defaultBoardId')
166160
if (defaultBoardId) {
167161
next({ name: 'board', params: { id: parseInt(defaultBoardId, 10) } })
168162
return
163+
} else {
164+
next({ name: 'upcoming' })
165+
return
169166
}
170167
}
168+
// Redirect if fullPath begins with a hash (ignore hashes later in path)
169+
if (to.hash.substring(0, 2) === '#/') {
170+
const path = to.fullPath.replace('/#/', '/').trimEnd('/')
171+
next(path)
172+
return
173+
}
171174
next()
172175
})
173176

0 commit comments

Comments
 (0)