diff --git a/ui/package.json b/ui/package.json index 6081ef819ece6ea7d9ae2ae995c3d07122612818..8b20bd31c2f8068a5559c73794ed858c14381af7 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,10 +1,10 @@ -{ +{ "name": "ui", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build --modern", + "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { diff --git a/ui/public/index.html b/ui/public/index.html index f4ad6652bce20bd96dac64404ec28b990375b317..3f033213c9fd90a7f35c3ef2b8da1b319bbdae77 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -11,7 +11,7 @@ <noscript> <strong>We're sorry but ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> </noscript> - <div id="app"></div> + <div id="app" apiurl="http://localhost:3000"></div> <!-- built files will be auto injected --> </body> </html> diff --git a/ui/src/App.vue b/ui/src/App.vue index 2df95a59f2509e0ad4ea7b4c8cdc7d7178f626b2..3a5ded510a3f9300e233e1cbbbc7b4730012a6e0 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -2,6 +2,7 @@ <div id="app"> <div class="drop-file-wrapper"> <DropFile + :apiurl="apiurl" v-if="state == 'visible-drop'" v-on:stamp="onStamp()" v-on:failed-stamp="onFailedStamp()" @@ -37,6 +38,7 @@ export default { name: 'app', + props: ['apiurl'], data: function() { return { state: 'visible-drop', diff --git a/ui/src/components/DropFile.vue b/ui/src/components/DropFile.vue index 4d694ae202fce20cb51f25b1eafe3024b29049ef..fd24551b453c96b0ddaa4891abcca5de014f743e 100644 --- a/ui/src/components/DropFile.vue +++ b/ui/src/components/DropFile.vue @@ -47,6 +47,7 @@ import axios from "axios" export default { name: 'DropFile', + props: ['apiurl'], data: function() { return { loading: false, @@ -68,9 +69,8 @@ export default { verify() { var self = this; - let baseUrl = process.env.VUE_APP_API_URL let hash = self.uploadedFiles[0].hash - let verifyUrl = `${baseUrl}/verify/${hash}` + let verifyUrl = `${this.apiurl}/verify/${hash}` self.loading = true axios.get(verifyUrl).then((res) => { console.log(res.data) @@ -87,8 +87,7 @@ export default { stamp() { var self = this; - let baseUrl = process.env.VUE_APP_API_URL - let stampUrl = `${baseUrl}/stamp` + let stampUrl = `${this.apiurl}/stamp` self.loading = true axios.post(stampUrl, { hashes: [self.uploadedFiles[0].hash] diff --git a/ui/src/main.js b/ui/src/main.js index 3b03b9f368c791b53cbc255952aeba274b16c2d5..14905afc82812ddc49ceeb4289a993d59a90e5b1 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -4,5 +4,11 @@ import App from './App.vue' Vue.config.productionTip = false new Vue({ - render: h => h(App), + render(h) { + return h(App, { + props: { + apiurl: this.$el.attributes.apiurl.value + } + }) + } }).$mount('#app') \ No newline at end of file