Skip to content

Commit b95243b

Browse files
authored
fix(client): fix incorrectly specified redirects in router (#1809)
1 parent 1f33f52 commit b95243b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

client/src/router.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
1+
import {
2+
createRouter,
3+
createWebHistory,
4+
type RouteRecordRaw,
5+
type RouteLocation,
6+
} from "vue-router";
27
import { isOfficialSite } from "./util/misc";
38

49
export const routes: RouteRecordRaw[] = [
@@ -24,11 +29,11 @@ export const routes: RouteRecordRaw[] = [
2429
},
2530
{
2631
path: "/r/:roomId",
27-
redirect: "/room/:roomId",
32+
redirect: redirectToRoom,
2833
},
2934
{
3035
path: "/rooms/:roomId",
31-
redirect: "/room/:roomId",
36+
redirect: redirectToRoom,
3237
},
3338
{
3439
path: "/passwordreset",
@@ -41,6 +46,10 @@ export const routes: RouteRecordRaw[] = [
4146
},
4247
];
4348

49+
function redirectToRoom(to: RouteLocation) {
50+
return { name: "room", params: { roomId: to.params.roomId } };
51+
}
52+
4453
// FIXME: only render on official site
4554
if (import.meta.env.DEV || isOfficialSite()) {
4655
routes.push({

0 commit comments

Comments
 (0)