fixing error

This commit is contained in:
dhilanradya 2025-10-20 17:28:57 +07:00
parent d48ec1a1fd
commit 7cd3e54402
3 changed files with 34 additions and 5 deletions

View File

@ -563,8 +563,22 @@ const closeItemModal = () => {
editedProduct.value = null; editedProduct.value = null;
}; };
const back = () => { const back = async () => {
router.push("/produk"); loading.value = true;
try{
console.log(localStorage.getItem("token"));
await axios.delete('/api/all/foto', {
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
});
router.push('/produk');
} catch (e){
console.error("Error image ", e);
} finally {
loading.value = false;
}
}; };
onMounted(async () => { onMounted(async () => {

View File

@ -468,8 +468,23 @@ const submitForm = async (addItem) => {
} }
}; };
const back = () => {
router.push('/produk'); const back = async () => {
loading.value = true;
try{
console.log(localStorage.getItem("token"));
await axios.delete('/api/all/foto', {
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
});
router.push('/produk');
} catch (e){
console.error("Error image ", e);
} finally {
loading.value = false;
}
}; };
const openCreateItemModal = (product) => { const openCreateItemModal = (product) => {

View File

@ -37,7 +37,7 @@ Route::prefix('api')->group(function () {
Route::post('foto', [FotoSementaraController::class, 'upload']); Route::post('foto', [FotoSementaraController::class, 'upload']);
Route::delete('foto/{id}', [FotoSementaraController::class, 'hapus']); Route::delete('foto/{id}', [FotoSementaraController::class, 'hapus']);
Route::get('produk/edit/{id}', [ProdukController::class, 'edit']); Route::get('produk/edit/{id}', [ProdukController::class, 'edit']);
Route::delete('foto/all', [FotoSementaraController::class, 'reset']); Route::delete('all/foto', [FotoSementaraController::class, 'reset']);
// Laporan // Laporan
Route::prefix('laporan')->group(function () { Route::prefix('laporan')->group(function () {