Skip to content
Snippets Groups Projects
Commit 7f45d7c3 authored by Adam Procter's avatar Adam Procter
Browse files

moved API call to an EventService.js

Now can be used every where and add in credentials
parent 5964139c
Branches
No related tags found
No related merge requests found
import axios from 'axios'
const apiClient = axios.create({
baseURL: 'https://api.kinopio.club',
withCredentials: false,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
})
export default {
getNewSpaces() {
return apiClient.get('/space/new-spaces')
},
}
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<script> <script>
// @ is an alias to /src // @ is an alias to /src
import SampleComponent from '@/components/SampleComponent.vue' import SampleComponent from '@/components/SampleComponent.vue'
import axios from 'axios' import EventService from '@/services/EventService.js'
export default { export default {
name: 'Home', name: 'Home',
...@@ -25,12 +25,10 @@ export default { ...@@ -25,12 +25,10 @@ export default {
} }
}, },
created() { created() {
// should split into base URL and then get EventService.getNewSpaces()
axios
.get('https://api.kinopio.club/space/new-spaces')
.then((response) => { .then((response) => {
this.new_spaces = response.data this.new_spaces = response.data
console.log('new_spaces:', response.data) // console.log('new_spaces:', response.data)
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment