Make event & create event & map async components

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-05-31 15:13:07 +02:00
parent 55cd3bc54a
commit 0a1f955194
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
2 changed files with 11 additions and 6 deletions

View File

@ -1,9 +1,12 @@
import EventList from '@/views/Event/EventList.vue'; import EventList from '@/views/Event/EventList.vue';
import Location from '@/views/Location.vue'; import Location from '@/views/Location.vue';
import CreateEvent from '@/views/Event/Create.vue';
import Event from '@/views/Event/Event.vue';
import { RouteConfig } from 'vue-router'; import { RouteConfig } from 'vue-router';
// tslint:disable:space-in-parens
const createEvent = () => import(/* webpackChunkName: "create-event" */ '@/views/Event/Create.vue');
const event = () => import(/* webpackChunkName: "event" */ '@/views/Event/Event.vue');
// tslint:enable
export enum EventRouteName { export enum EventRouteName {
EVENT_LIST = 'EventList', EVENT_LIST = 'EventList',
CREATE_EVENT = 'CreateEvent', CREATE_EVENT = 'CreateEvent',
@ -22,13 +25,13 @@ export const eventRoutes: RouteConfig[] = [
{ {
path: '/events/create', path: '/events/create',
name: EventRouteName.CREATE_EVENT, name: EventRouteName.CREATE_EVENT,
component: CreateEvent, component: createEvent,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: '/events/:id/edit', path: '/events/:id/edit',
name: EventRouteName.EDIT_EVENT, name: EventRouteName.EDIT_EVENT,
component: CreateEvent, component: createEvent,
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
@ -41,7 +44,7 @@ export const eventRoutes: RouteConfig[] = [
{ {
path: '/events/:uuid', path: '/events/:uuid',
name: EventRouteName.EVENT, name: EventRouteName.EVENT,
component: Event, component: event,
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },

View File

@ -249,7 +249,9 @@ import EventFullDate from '@/components/Event/EventFullDate.vue';
EventCard, EventCard,
BIcon, BIcon,
DateCalendarIcon, DateCalendarIcon,
'map-leaflet': () => import('@/components/Map.vue'), // tslint:disable:space-in-parens
'map-leaflet': () => import(/* webpackChunkName: "map" */ '@/components/Map.vue'),
// tslint:enable
}, },
apollo: { apollo: {
event: { event: {