Added support for API

This commit is contained in:
2021-09-06 19:38:38 +02:00
parent d9e097073b
commit 8d4f9985e2
5 changed files with 52 additions and 84 deletions

View File

@@ -25,12 +25,20 @@ const moduleSettings = {
},
actions: {
fetchProjects (store) {
return fetch('/api/projects.json')
return fetch('https://api.kamilcraft.com/projects')
.then(response => response.json())
.then(data => {
store.commit('setProjects', data)
return store.getters.getProjects
})
},
fetchCategories (store) {
return fetch('https://api.kamilcraft.com/categories')
.then(response => response.json())
.then(data => {
store.commit('setCategories', data)
return store.getters.getCategories
})
}
},
mutations: {