fix(fe pllaylist): fixed axios calls and added create call

This commit is contained in:
Marco Cavalli 2025-03-19 12:14:15 +01:00
parent 51c056f1a2
commit e62558eba0

View file

@ -47,10 +47,17 @@ export function playlist_page() {
})
}
const createItem = async (item) => {
return await axios.post(`playlist`, item
).then((response) => {
console.log(response)
})
}
const editItem = (item) => {
item['_method'] = 'PUT'
return axios.post(`file/${item.id}`, item
return axios.post(`playlist/${item.id}`, item
).then((response) => {
console.log(response)
})
@ -58,7 +65,7 @@ export function playlist_page() {
const deleteItem = (id) => {
return axios.post(`file/${id}`, {
return axios.post(`playlist/${id}`, {
_method: 'DELETE'
}).then((response) => {
getItems(listData)
@ -66,5 +73,5 @@ export function playlist_page() {
})
}
return { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem }
return { items, listData, headers, selected, loading, search, getItems, createItem, editItem, deleteItem }
}