forked from potsda.mn/mobilizon
Use the enum for error route
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
a40d202dd7
commit
cb00f6f6b0
|
@ -2,6 +2,7 @@ import { ErrorCode } from "@/types/enums";
|
||||||
import { NavigationGuard } from "vue-router";
|
import { NavigationGuard } from "vue-router";
|
||||||
import { CONFIG } from "../../graphql/config";
|
import { CONFIG } from "../../graphql/config";
|
||||||
import apolloProvider from "../../vue-apollo";
|
import apolloProvider from "../../vue-apollo";
|
||||||
|
import { ErrorRouteName } from "../error";
|
||||||
|
|
||||||
export const beforeRegisterGuard: NavigationGuard = async (to, from, next) => {
|
export const beforeRegisterGuard: NavigationGuard = async (to, from, next) => {
|
||||||
const { data } = await apolloProvider.defaultClient.query({
|
const { data } = await apolloProvider.defaultClient.query({
|
||||||
|
@ -12,7 +13,7 @@ export const beforeRegisterGuard: NavigationGuard = async (to, from, next) => {
|
||||||
|
|
||||||
if (!config.registrationsOpen && !config.registrationsAllowlist) {
|
if (!config.registrationsOpen && !config.registrationsAllowlist) {
|
||||||
return next({
|
return next({
|
||||||
name: "Error",
|
name: ErrorRouteName.ERROR,
|
||||||
query: { code: ErrorCode.REGISTRATION_CLOSED },
|
query: { code: ErrorCode.REGISTRATION_CLOSED },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue