From 84823ac7c2e54ecd0990c1e1dffcb1ef38d2fd85 Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Fri, 24 Apr 2020 10:32:14 +0200 Subject: [PATCH 1/4] Add vue-router for routing --- client/package-lock.json | 5 +++++ client/package.json | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/package-lock.json b/client/package-lock.json index bcec67f..7bdc916 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -11325,6 +11325,11 @@ "got": "^8.0.3" } }, + "vue-router": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.6.tgz", + "integrity": "sha512-GYhn2ynaZlysZMkFE5oCHRUTqE8BWs/a9YbKpNLi0i7xD6KG1EzDqpHQmv1F5gXjr8kL5iIVS8EOtRaVUEXTqA==" + }, "vue-style-loader": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz", diff --git a/client/package.json b/client/package.json index 4016028..c8f13c6 100644 --- a/client/package.json +++ b/client/package.json @@ -23,7 +23,8 @@ "dependencies": { "core-js": "^3.6.5", "vue": "^2.6.11", - "vue-resource": "^1.5.1" + "vue-resource": "^1.5.1", + "vue-router": "^3.1.6" }, "devDependencies": { "babel-eslint": "^10.0.3", From ec30b39ffbb2d292fff7a57032a0a32faaec4389 Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Fri, 24 Apr 2020 10:57:31 +0200 Subject: [PATCH 2/4] Create Home view --- client/src/views/Home.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 client/src/views/Home.vue diff --git a/client/src/views/Home.vue b/client/src/views/Home.vue new file mode 100644 index 0000000..944a7da --- /dev/null +++ b/client/src/views/Home.vue @@ -0,0 +1,19 @@ + + + + + From fd4206b989ab25f65b97ffed76ca0bb1f2e66184 Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Fri, 24 Apr 2020 10:58:53 +0200 Subject: [PATCH 3/4] Define router with routes for Home and posts --- client/src/router/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 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..d42ca9b --- /dev/null +++ b/client/src/router/index.js @@ -0,0 +1,27 @@ +import Vue from 'vue' +import VueRouter from 'vue-router' +import Home from '../views/Home.vue' +import posts from '../views/posts.vue' + +Vue.use(VueRouter) + +const routes = [ + { + path: "/", + name: "Home", + component: Home, + }, + { + path: "/posts", + name: "Posts", + component: posts, + }, +] + +const router = new VueRouter({ + mode: "history", + base: process.env.BASE_URL, + routes, +}) + +export default router From 0e86f566493662a0a7014088161132905b96ac9a Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Fri, 24 Apr 2020 10:59:29 +0200 Subject: [PATCH 4/4] Add router --- client/src/App.vue | 7 ++++++- client/src/main.js | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/App.vue b/client/src/App.vue index af14228..24f95df 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -1,5 +1,10 @@ diff --git a/client/src/main.js b/client/src/main.js index 59f4122..ca5c0fc 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -2,6 +2,7 @@ import Vue from 'vue' import VueResource from 'vue-resource' import App from './App.vue' +import router from './router' Vue.config.productionTip = false @@ -9,4 +10,5 @@ Vue.use(VueResource) new Vue({ render: h => h(App), + router, }).$mount('#app')