Переглянути джерело

Adding Axios API for web requests

Currently only runs one test call.
Ecconia 7 роки тому
батько
коміт
e6ea2c1562
2 змінених файлів з 8 додано та 1 видалено
  1. 1 0
      package.json
  2. 7 1
      src/scripts/core.js

+ 1 - 0
package.json

@@ -8,6 +8,7 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
+    "axios": "^0.18.0",
     "vue": "^2.5.17",
     "vue-router": "^3.0.1",
     "vuex": "^3.0.1"

+ 7 - 1
src/scripts/core.js

@@ -6,6 +6,12 @@ export default class {
 	}
 
 	lol(username, password) {
-		alert('Login attempt as user \'' + username + '\' with password \'' + password + '\'')
+		axios.get('https://live.ecconia.de/soos')
+			.then(function (response) {
+				console.log('Response: ', response.data)
+			})
+			.catch(function (error) {
+				console.error('Error: ', error)
+			})
 	}
 }