Introduce group basic federation, event new page and notifications
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
import { apolloProvider } from '@/vue-apollo';
|
||||
import { CONFIG } from '@/graphql/config';
|
||||
import { IConfig } from '@/types/config.model';
|
||||
import { NavigationGuard } from 'vue-router';
|
||||
import { ErrorRouteName } from '@/router/error';
|
||||
import { ErrorCode } from '@/types/error-code.model';
|
||||
import { NavigationGuard } from "vue-router";
|
||||
import { CONFIG } from "../../graphql/config";
|
||||
import { ErrorCode } from "../../types/error-code.model";
|
||||
import apolloProvider from "../../vue-apollo";
|
||||
|
||||
export const beforeRegisterGuard: NavigationGuard = async function (to, from, next) {
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const beforeRegisterGuard: NavigationGuard = async (to, from, next) => {
|
||||
const { data } = await apolloProvider.defaultClient.query({
|
||||
query: CONFIG,
|
||||
});
|
||||
|
||||
const config: IConfig = data.config;
|
||||
const { config } = data;
|
||||
|
||||
if (!config.registrationsOpen && !config.registrationsWhitelist) {
|
||||
return next({
|
||||
name: ErrorRouteName.ERROR,
|
||||
name: "Error",
|
||||
query: { code: ErrorCode.REGISTRATION_CLOSED },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user