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
No related branches found
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 @@
<script>
// @ is an alias to /src
import SampleComponent from '@/components/SampleComponent.vue'
import axios from 'axios'
import EventService from '@/services/EventService.js'
export default {
name: 'Home',
......@@ -25,12 +25,10 @@ export default {
}
},
created() {
// should split into base URL and then get
axios
.get('https://api.kinopio.club/space/new-spaces')
EventService.getNewSpaces()
.then((response) => {
this.new_spaces = response.data
console.log('new_spaces:', response.data)
// console.log('new_spaces:', response.data)
})
.catch((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