about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nuxt.config.js3
-rw-r--r--pages/kronika/index.vue4
2 files changed, 6 insertions, 1 deletions
diff --git a/nuxt.config.js b/nuxt.config.js
index 036135b..44a1de3 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -40,6 +40,9 @@ export default {
       }
     ]
   },
+  env: {
+    baseUrl: process.env.DEPLOY_URL || 'http://localhost:3000'
+  },
   generate: {
     routes: k.getPosts().map(post => post.route)
   },
diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue
index 13322f4..20341e9 100644
--- a/pages/kronika/index.vue
+++ b/pages/kronika/index.vue
@@ -32,7 +32,9 @@ export default {
   methods: {
     getPosts() {
       if (this.posts.length < 1) {
-        this.$axios.get(`/api/posts.json`).then(r => (this.posts = r.data))
+        this.$axios
+          .get(`${process.env.baseUrl}/api/posts.json`)
+          .then(r => (this.posts = r.data))
       }
       console.log(this.posts)
     }