|
|
@@ -5,29 +5,46 @@ export default class {
|
|
|
this.vuex = vuex
|
|
|
}
|
|
|
|
|
|
+ commit(method, data)
|
|
|
+ {
|
|
|
+ this.vuex.commit(method, data)
|
|
|
+ }
|
|
|
+
|
|
|
+ post(path, data)
|
|
|
+ {
|
|
|
+ return axios
|
|
|
+ .post('https://live.ecconia.de' + path, data)
|
|
|
+ .catch((error) => {
|
|
|
+ console.error('Error: ', error)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ get(path)
|
|
|
+ {
|
|
|
+ return axios
|
|
|
+ .get('https://live.ecconia.de' + path)
|
|
|
+ .catch((error) => {
|
|
|
+ console.error('Error: ', error)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
lol(username, password) {
|
|
|
//TODO: return promise somehow
|
|
|
//alert('Login attempt as user \'' + username + '\' with password \'' + password + '\'')
|
|
|
|
|
|
/*
|
|
|
- axios.get('https://live.ecconia.de/soos')
|
|
|
+ this.get('/soos')
|
|
|
.then(function (response) {
|
|
|
console.log('Response: ', response.data)
|
|
|
})
|
|
|
- .catch(function (error) {
|
|
|
- console.error('Error: ', error)
|
|
|
- })
|
|
|
*/
|
|
|
|
|
|
- axios.post('https://live.ecconia.de/login', {
|
|
|
+ this.post('/login', {
|
|
|
username: username,
|
|
|
password: password,
|
|
|
}).then((response) => {
|
|
|
console.log('Response: ', response.data)
|
|
|
- this.vuex.commit('setUser', response.data)
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- console.error('Error: ', error)
|
|
|
+ this.commit('setUser', response.data)
|
|
|
})
|
|
|
}
|
|
|
}
|