-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
35 lines (34 loc) · 830 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict'
let app = new Vue({
el: '#app',
data: {
error: false,
errorMessage: '',
domain: '',
items: null,
history: null
},
methods: {
searchInfo: function () {
if (this.domain) {
axios.get(`http://localhost:3000/servers/${this.domain}`).then(response => {
this.items = response.data
}).catch(err => {
this.error = true
this.errorMessage = err.message
})
} else {
this.error = true
this.errorMessage = 'Please, enter the domain for search the info'
}
},
showHistory: function () {
axios.get(`http://localhost:3000/servers`).then(response => {
this.history = response.data
}).catch(err => {
this.error = true
this.errorMessage = err.message
})
}
}
})