Skip to content
Snippets Groups Projects
Commit cd3ef481 authored by Andrés Blanco's avatar Andrés Blanco
Browse files

se parametriza la url a través de una prop en el html para hacer más fácil el embedding

parent 7e42c24f
No related branches found
No related tags found
No related merge requests found
{ {
"name": "ui", "name": "ui",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build --modern", "build": "vue-cli-service build",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<noscript> <noscript>
<strong>We're sorry but ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app" apiurl="http://localhost:3000"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
</html> </html>
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<div id="app"> <div id="app">
<div class="drop-file-wrapper"> <div class="drop-file-wrapper">
<DropFile <DropFile
:apiurl="apiurl"
v-if="state == 'visible-drop'" v-if="state == 'visible-drop'"
v-on:stamp="onStamp()" v-on:stamp="onStamp()"
v-on:failed-stamp="onFailedStamp()" v-on:failed-stamp="onFailedStamp()"
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
export default { export default {
name: 'app', name: 'app',
props: ['apiurl'],
data: function() { data: function() {
return { return {
state: 'visible-drop', state: 'visible-drop',
......
...@@ -47,6 +47,7 @@ import axios from "axios" ...@@ -47,6 +47,7 @@ import axios from "axios"
export default { export default {
name: 'DropFile', name: 'DropFile',
props: ['apiurl'],
data: function() { data: function() {
return { return {
loading: false, loading: false,
...@@ -68,9 +69,8 @@ export default { ...@@ -68,9 +69,8 @@ export default {
verify() { verify() {
var self = this; var self = this;
let baseUrl = process.env.VUE_APP_API_URL
let hash = self.uploadedFiles[0].hash let hash = self.uploadedFiles[0].hash
let verifyUrl = `${baseUrl}/verify/${hash}` let verifyUrl = `${this.apiurl}/verify/${hash}`
self.loading = true self.loading = true
axios.get(verifyUrl).then((res) => { axios.get(verifyUrl).then((res) => {
console.log(res.data) console.log(res.data)
...@@ -87,8 +87,7 @@ export default { ...@@ -87,8 +87,7 @@ export default {
stamp() { stamp() {
var self = this; var self = this;
let baseUrl = process.env.VUE_APP_API_URL let stampUrl = `${this.apiurl}/stamp`
let stampUrl = `${baseUrl}/stamp`
self.loading = true self.loading = true
axios.post(stampUrl, { axios.post(stampUrl, {
hashes: [self.uploadedFiles[0].hash] hashes: [self.uploadedFiles[0].hash]
......
...@@ -4,5 +4,11 @@ import App from './App.vue' ...@@ -4,5 +4,11 @@ import App from './App.vue'
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({
render: h => h(App), render(h) {
return h(App, {
props: {
apiurl: this.$el.attributes.apiurl.value
}
})
}
}).$mount('#app') }).$mount('#app')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment