From f66312ee26256da9b58e8997c47987dbbda713ac Mon Sep 17 00:00:00 2001 From: Muhammad Iqbal Rifai Date: Wed, 4 Jul 2018 19:12:40 +0200 Subject: [PATCH] Upload files to 'client/src/router' --- client/src/router/index.js | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 client/src/router/index.js diff --git a/client/src/router/index.js b/client/src/router/index.js new file mode 100644 index 0000000..194ccc0 --- /dev/null +++ b/client/src/router/index.js @@ -0,0 +1,49 @@ +import Vue from "vue"; +import Router from "vue-router"; +import Home from "@/components/Home"; +import User from "@/components/User"; +import Serie from "@/components/Series"; +import InfoSerie from "@/components/InfoSerie"; +import Ver from "@/components/Ver"; +import AuthSuccess from "@/components/AuthSuccess"; +import Auth from "@/components/Auth"; +import firebase from "firebase"; + +Vue.use(Router); +let router = new Router({ + /* export default new Router({ */ + mode: "history", + base: __dirname, + routes: [ + { + path: "/", + name: "Home", + component: Home + }, + { + path: "/user", + name: "User", + component: User + }, + { + path: "/series", + name: "Series", + component: Serie/* , + meta: { requiresAuth: true } */ + }, + { path: "/series/:slug", component: InfoSerie, name: "InfoSeries" }, + { path: "/ver/:slug", component: Ver, name: "Ver" }, + { path: "/auth", component: Auth }, + { path: "/success", component: AuthSuccess } + ] +}); +/* +router.beforeEach((to, from, next) => { + let currentUser = firebase.auth().currentUser; + let requiresAuth = to.matched.some(record => record.meta.requiresAuth); + + if (requiresAuth && !currentUser) next('auth') + else if (!requiresAuth && currentUser) next('hello') + else next() +}) */ +export default router;