From 9d9947d7dc0b9c61e08661583b52b7f5bc57d54e Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 11 Oct 2020 13:53:08 +0200 Subject: [PATCH 1/3] Router mode history, and all routes got names. --- src/router.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/router.js b/src/router.js index 757cf6a..2dad198 100644 --- a/src/router.js +++ b/src/router.js @@ -1,3 +1,5 @@ +import VueRouter from "vue-router"; + import VinlottisPage from "@/components/VinlottisPage"; import GeneratePage from "@/components/GeneratePage"; import TodaysPage from "@/components/TodaysPage"; @@ -19,30 +21,37 @@ import AllRequestedWines from "@/components/AllRequestedWines"; const routes = [ { path: "*", + name: "Hjem", component: VinlottisPage }, { path: "/lottery", + name: "Lotteri", component: LotteryPage }, { path: "/dagens", + name: "Dagens vin", component: TodaysPage }, { path: "/viner", + name: "Alle viner", component: AllWinesPage }, { path: "/login", + name: "Login", component: LoginPage }, { path: "/create", + name: "Registrer", component: CreatePage }, { path: "/admin", + name: "Admin", component: AdminPage }, { @@ -54,21 +63,40 @@ const routes = [ component: WinnerPage }, { - path: "/history", + path: "/history/:date", + name: "Historie for dato", component: HistoryPage }, + { + path: "/history/", + name: "Historie", + component: HistoryPage + }, + { + path: "/highscore/:name", + name: "Personlig toppliste", + component: PersonalHighscorePage + }, { path: "/highscore", + name: "Topplisten", component: HighscorePage }, { path: "/request", + name: "Etterspør vin", component: RequestWine }, { path: "/requested-wines", + name: "Etterspurte viner", component: AllRequestedWines } ]; -export { routes }; +const router = new VueRouter({ + routes: routes, + mode: "history" +}); + +export default router; From 2062f64999f06c9d70e39f88fe69aabaac58412c Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 11 Oct 2020 13:54:16 +0200 Subject: [PATCH 2/3] Import VueRouter instance from router.js. --- src/vinlottis-init.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/vinlottis-init.js b/src/vinlottis-init.js index f362976..52cc5a7 100644 --- a/src/vinlottis-init.js +++ b/src/vinlottis-init.js @@ -1,6 +1,6 @@ import Vue from "vue"; import VueRouter from "vue-router"; -import { routes } from "@/router.js"; +import VinlottisRouter from "@/router.js"; import Vinlottis from "@/Vinlottis"; import VueAnalytics from "vue-analytics"; @@ -9,13 +9,9 @@ Vue.use(VueAnalytics, { id: "UA-156846886-1" }); -const router = new VueRouter({ - routes: routes -}); - new Vue({ el: "#app", - router, + router: VinlottisRouter, components: { Vinlottis }, template: "", render: h => h(Vinlottis) From 092396554412693fbf665fcc6462cdb7c2e21316 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 11 Oct 2020 13:56:17 +0200 Subject: [PATCH 3/3] Removed hash from routes. --- api/message.js | 2 +- api/update.js | 2 +- src/components/VinlottisPage.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/message.js b/api/message.js index a763a7b..d385019 100644 --- a/api/message.js +++ b/api/message.js @@ -7,7 +7,7 @@ async function sendWineSelectMessage(winnerObject) { winnerObject.timestamp_limit = new Date().getTime() * 600000; await winnerObject.save(); - let url = new URL(`/#/winner/${winnerObject.id}`, "https://lottis.vin"); + let url = new URL(`/winner/${winnerObject.id}`, "https://lottis.vin"); return sendMessageToUser( winnerObject.phoneNumber, diff --git a/api/update.js b/api/update.js index 59642dc..785ae0c 100644 --- a/api/update.js +++ b/api/update.js @@ -39,7 +39,7 @@ const submitWines = async (req, res) => { const message = JSON.stringify({ message: "Dagens vin er lagt til, se den på lottis.vin/dagens!", title: "Ny vin!", - link: "/#/dagens" + link: "/dagens" }); try { diff --git a/src/components/VinlottisPage.vue b/src/components/VinlottisPage.vue index e683a12..a7b1afd 100644 --- a/src/components/VinlottisPage.vue +++ b/src/components/VinlottisPage.vue @@ -13,7 +13,7 @@ />
- Vil du til lotteriet?Trykk her + Vil du til lotteriet?Trykk her