Use the enum for error route

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-05-12 18:27:52 +02:00
parent a40d202dd7
commit cb00f6f6b0
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -2,6 +2,7 @@ import { ErrorCode } from "@/types/enums";
import { NavigationGuard } from "vue-router";
import { CONFIG } from "../../graphql/config";
import apolloProvider from "../../vue-apollo";
import { ErrorRouteName } from "../error";
export const beforeRegisterGuard: NavigationGuard = async (to, from, next) => {
const { data } = await apolloProvider.defaultClient.query({
@ -12,7 +13,7 @@ export const beforeRegisterGuard: NavigationGuard = async (to, from, next) => {
if (!config.registrationsOpen && !config.registrationsAllowlist) {
return next({
name: "Error",
name: ErrorRouteName.ERROR,
query: { code: ErrorCode.REGISTRATION_CLOSED },
});
}