Merge pull request #45 from KevinMidboe/feat/history-router
Feat vue router mode changed to history
This commit is contained in:
		| @@ -7,7 +7,7 @@ async function sendWineSelectMessage(winnerObject) { | |||||||
|   winnerObject.timestamp_limit = new Date().getTime() * 600000; |   winnerObject.timestamp_limit = new Date().getTime() * 600000; | ||||||
|   await winnerObject.save(); |   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( |   return sendMessageToUser( | ||||||
|     winnerObject.phoneNumber, |     winnerObject.phoneNumber, | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ const submitWines = async (req, res) => { | |||||||
|     const message = JSON.stringify({ |     const message = JSON.stringify({ | ||||||
|       message: "Dagens vin er lagt til, se den på lottis.vin/dagens!", |       message: "Dagens vin er lagt til, se den på lottis.vin/dagens!", | ||||||
|       title: "Ny vin!", |       title: "Ny vin!", | ||||||
|       link: "/#/dagens" |       link: "/dagens" | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     try { |     try { | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ | |||||||
|           /> |           /> | ||||||
|       </section> |       </section> | ||||||
|       <div class="to-lottery-container"> |       <div class="to-lottery-container"> | ||||||
|         <a href="#/lottery" class="to-lottery">Vil du til lotteriet?<span class="vin-link">Trykk her</span></a> |         <router-link to="/lottery" class="to-lottery">Vil du til lotteriet?<span class="vin-link">Trykk her</span></router-link> | ||||||
|       </div> |       </div> | ||||||
|       <section class="chart-container"> |       <section class="chart-container"> | ||||||
|         <PurchaseGraph class="purchase" /> |         <PurchaseGraph class="purchase" /> | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | import VueRouter from "vue-router"; | ||||||
|  |  | ||||||
| import VinlottisPage from "@/components/VinlottisPage"; | import VinlottisPage from "@/components/VinlottisPage"; | ||||||
| import GeneratePage from "@/components/GeneratePage"; | import GeneratePage from "@/components/GeneratePage"; | ||||||
| import TodaysPage from "@/components/TodaysPage"; | import TodaysPage from "@/components/TodaysPage"; | ||||||
| @@ -20,30 +22,37 @@ import AllRequestedWines from "@/components/AllRequestedWines"; | |||||||
| const routes = [ | const routes = [ | ||||||
|   { |   { | ||||||
|     path: "*", |     path: "*", | ||||||
|  |     name: "Hjem", | ||||||
|     component: VinlottisPage |     component: VinlottisPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/lottery", |     path: "/lottery", | ||||||
|  |     name: "Lotteri", | ||||||
|     component: LotteryPage |     component: LotteryPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/dagens", |     path: "/dagens", | ||||||
|  |     name: "Dagens vin", | ||||||
|     component: TodaysPage |     component: TodaysPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/viner", |     path: "/viner", | ||||||
|  |     name: "Alle viner", | ||||||
|     component: AllWinesPage |     component: AllWinesPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/login", |     path: "/login", | ||||||
|  |     name: "Login", | ||||||
|     component: LoginPage |     component: LoginPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/create", |     path: "/create", | ||||||
|  |     name: "Registrer", | ||||||
|     component: CreatePage |     component: CreatePage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/admin", |     path: "/admin", | ||||||
|  |     name: "Admin", | ||||||
|     component: AdminPage |     component: AdminPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
| @@ -55,25 +64,40 @@ const routes = [ | |||||||
|     component: WinnerPage |     component: WinnerPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/history", |     path: "/history/:date", | ||||||
|  |     name: "Historie for dato", | ||||||
|  |     component: HistoryPage | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     path: "/history/", | ||||||
|  |     name: "Historie", | ||||||
|     component: HistoryPage |     component: HistoryPage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/highscore/:name", |     path: "/highscore/:name", | ||||||
|  |     name: "Personlig toppliste", | ||||||
|     component: PersonalHighscorePage |     component: PersonalHighscorePage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/highscore", |     path: "/highscore", | ||||||
|  |     name: "Topplisten", | ||||||
|     component: HighscorePage |     component: HighscorePage | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/request", |     path: "/request", | ||||||
|  |     name: "Etterspør vin", | ||||||
|     component: RequestWine |     component: RequestWine | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     path: "/requested-wines", |     path: "/requested-wines", | ||||||
|  |     name: "Etterspurte viner", | ||||||
|     component: AllRequestedWines |     component: AllRequestedWines | ||||||
|   } |   } | ||||||
| ]; | ]; | ||||||
|  |  | ||||||
| export { routes }; | const router = new VueRouter({ | ||||||
|  |   routes: routes, | ||||||
|  |   mode: "history" | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | export default router; | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| import Vue from "vue"; | import Vue from "vue"; | ||||||
| import VueRouter from "vue-router"; | import VueRouter from "vue-router"; | ||||||
| import { routes } from "@/router.js"; | import VinlottisRouter from "@/router.js"; | ||||||
| import Vinlottis from "@/Vinlottis"; | import Vinlottis from "@/Vinlottis"; | ||||||
| import VueAnalytics from "vue-analytics"; | import VueAnalytics from "vue-analytics"; | ||||||
|  |  | ||||||
| @@ -9,13 +9,9 @@ Vue.use(VueAnalytics, { | |||||||
|   id: "UA-156846886-1" |   id: "UA-156846886-1" | ||||||
| }); | }); | ||||||
|  |  | ||||||
| const router = new VueRouter({ |  | ||||||
|   routes: routes |  | ||||||
| }); |  | ||||||
|  |  | ||||||
| new Vue({ | new Vue({ | ||||||
|   el: "#app", |   el: "#app", | ||||||
|   router, |   router: VinlottisRouter, | ||||||
|   components: { Vinlottis }, |   components: { Vinlottis }, | ||||||
|   template: "<Vinlottis/>", |   template: "<Vinlottis/>", | ||||||
|   render: h => h(Vinlottis) |   render: h => h(Vinlottis) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user