Browse Source

editorconfig, axios base almost there

new-map
Ben Stähli 3 years ago
parent
commit
b479a18a1e
  1. 27
      .editorconfig
  2. 6
      package.json
  3. 2
      src/main.js
  4. 1
      src/plugins/vuetify.js
  5. 17
      src/services/Api.js
  6. 8
      src/services/DefinitionalFrameworksService.js
  7. 99
      src/views/InteractiveMap.vue

27
.editorconfig

@ -0,0 +1,27 @@
# EditorConfig is awesome: https://EditorConfig.org
# python oriented for now...may need adaptions!
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py,sass,scss}]
charset = utf-8
indent_style = space
indent_size = 4
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

6
package.json

@ -20,10 +20,10 @@
"@vue/cli-plugin-babel": "^3.0.5",
"@vue/cli-plugin-eslint": "^3.0.5",
"@vue/cli-service": "^3.0.5",
"vue-cli-plugin-vuetify": "^0.2.1",
"vue-template-compiler": "^2.5.17",
"node-sass": "^4.9.4",
"sass-loader": "^7.1.0"
"sass-loader": "^7.1.0",
"vue-cli-plugin-vuetify": "^0.2.1",
"vue-template-compiler": "^2.5.17"
},
"eslintConfig": {
"root": true,

2
src/main.js

@ -6,8 +6,10 @@ import router from './router'
import 'roboto-fontface/css/roboto/roboto-fontface.css'
import 'material-design-icons-iconfont/dist/material-design-icons.css'
Vue.config.productionTip = false
new Vue({
router,
render: h => h(App)

1
src/plugins/vuetify.js

@ -2,6 +2,7 @@ import Vue from 'vue'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css'
Vue.use(Vuetify, {
iconfont: 'md',
})

17
src/services/Api.js

@ -0,0 +1,17 @@
import axios from 'axios'
export default() => {
return axios.create({
baseURL: `https://clisel-data.vanhulst.one/api`,
auth: {
username: 'Clisel',
password: 'C4S2oymzmV'
},
// withCredentials: false,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
})
}

8
src/services/DefinitionalFrameworksService.js

@ -0,0 +1,8 @@
import Api from '@/services/Api'
export default {
getInstruments() {
return Api().get('/Instrument');
}
}

99
src/views/InteractiveMap.vue

@ -1,35 +1,76 @@
<template>
<v-container fluid>
<v-slide-y-transition mode="out-in">
<v-layout column align-center>
<img src="@/assets/logo.png" alt="Vuetify.js" class="mb-5">
<blockquote>
&#8220;First, solvadsvasdvasdvase the problem. Then, write the code.&#8221;
<footer>
<small>
<em>&mdash;John Johnson</em>
</small>
</footer>
</blockquote>
</v-layout>
</v-slide-y-transition>
</v-container>
<v-container fluid>
<v-slide-y-transition mode="out-in">
<v-layout column align-center>
<img src="@/assets/logo.png" alt="Vuetify.js" class="mb-5">
<blockquote>
&#8220;First, solvadsvasdvasdvase the problem. Then, write the code.&#8221;
<footer>
<small>
<em>&mdash;John Johnson</em>
</small>
</footer>
</blockquote>
</v-layout>
</v-slide-y-transition>
</v-container>
</template>
<script>
import DefinitionalFrameworksService from '@/services/DefinitionalFrameworksService'
export default {
name: 'InteractiveMap',
data () {
return {
loading: false,
items: []
}
},
created() {
// fetch the data when the view is created and the data is
// already being observed
this.fetchData()
},
watch: {
// call again the method if the route changes
'$route': 'fetchData'
},
methods: {
async fetchData () {
this.loading = true
const response = await DefinitionalFrameworksService.getInstruments()
console.log(response);
console.log(response.data);
this.items = response.data.results[0]
this.loading = false
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
Loading…
Cancel
Save