Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): fix incorrectly specified redirects in router #1809

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions client/src/router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import {
createRouter,
createWebHistory,
type RouteRecordRaw,
type RouteLocation,
} from "vue-router";

Check warning on line 6 in client/src/router.ts

View check run for this annotation

Codecov / codecov/patch

client/src/router.ts#L2-L6

Added lines #L2 - L6 were not covered by tests
import { isOfficialSite } from "./util/misc";

export const routes: RouteRecordRaw[] = [
Expand All @@ -24,11 +29,11 @@
},
{
path: "/r/:roomId",
redirect: "/room/:roomId",
redirect: redirectToRoom,

Check warning on line 32 in client/src/router.ts

View check run for this annotation

Codecov / codecov/patch

client/src/router.ts#L32

Added line #L32 was not covered by tests
},
{
path: "/rooms/:roomId",
redirect: "/room/:roomId",
redirect: redirectToRoom,

Check warning on line 36 in client/src/router.ts

View check run for this annotation

Codecov / codecov/patch

client/src/router.ts#L36

Added line #L36 was not covered by tests
},
{
path: "/passwordreset",
Expand All @@ -41,6 +46,10 @@
},
];

function redirectToRoom(to: RouteLocation) {
return { name: "room", params: { roomId: to.params.roomId } };
}

Check warning on line 52 in client/src/router.ts

View check run for this annotation

Codecov / codecov/patch

client/src/router.ts#L49-L52

Added lines #L49 - L52 were not covered by tests
// FIXME: only render on official site
if (import.meta.env.DEV || isOfficialSite()) {
routes.push({
Expand Down
Loading