before suspend

This commit is contained in:
2022-05-23 16:25:55 +02:00
parent 8fab301419
commit aec0b4356a
24 changed files with 1291 additions and 1067 deletions

View File

@@ -0,0 +1,29 @@
import { ref } from 'vue'
import axios from 'axios'
export default function useResource(resource) {
console.log('useBlog')
const items = ref([])
const item = ref(null)
const fetchAll = async () => {
await axios
.get(resource)
.then((response) => {
items.value = response.data
})
}
const fetchOne = async (id) => {
console.log('fetchOne', id)
await axios
.get(`${resource}/${id}`)
.then((response) => {
item.value = response.data
})
}
return {
items,
fetchAll,
item,
fetchOne
}
}