merapikan koding
This commit is contained in:
@@ -149,7 +149,7 @@
|
||||
sex: { required },
|
||||
type: { required },
|
||||
featured_image: { imageType, maxFileSize },
|
||||
featured_icon: { imageType, maxFileSize},
|
||||
featured_icon: { imageType, maxFileSize },
|
||||
}
|
||||
};
|
||||
const router = useRouter();
|
||||
@@ -164,7 +164,7 @@
|
||||
const featuredImageUploader = ref(null);
|
||||
const featuredIconUploader = ref(null);
|
||||
|
||||
const { data: form, refresh } = await useAsyncData('characters',
|
||||
const { data: form, refresh } = await useAsyncData('character-get',
|
||||
() => $fetch(`${config.public.apiBase}/character/characters/${route.params.id}/`, {}),
|
||||
);
|
||||
|
||||
@@ -192,10 +192,6 @@
|
||||
});
|
||||
|
||||
form.value.type = typeOptions.find(option => option.value === form.value.type);
|
||||
originalData.value = {
|
||||
...form.value,
|
||||
type: typeOptions.find(option => option.value === form.value.type),
|
||||
};
|
||||
});
|
||||
|
||||
const submitForm = async () => {
|
||||
@@ -219,16 +215,18 @@
|
||||
formData.append('featured_icon', form.value.featured_icon);
|
||||
}
|
||||
|
||||
isLoading.value = true;
|
||||
await $fetch(`${config.public.apiBase}/character/characters/${route.params.id}/`, {
|
||||
method: 'PUT',
|
||||
body: formData
|
||||
}).then(() => {
|
||||
//redirect
|
||||
router.push({ path: "/character/characters/list" });
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
console.log(error);
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</NuxtLink>
|
||||
</div>
|
||||
<div class="mb-5">
|
||||
<input v-model.lazy="params.search" type="text" class="form-input max-w-xs" placeholder="Cari..." @change="changeSearch"/>
|
||||
<input v-model.lazy="params.search" type="text" class="form-input max-w-xs" placeholder="Cari... (tombol Enter untuk mencari)" @change="changeSearch"/>
|
||||
</div>
|
||||
<div class="mb-5">
|
||||
<div class="datatable">
|
||||
@@ -80,7 +80,7 @@
|
||||
sort: false,
|
||||
width: '150px'
|
||||
}
|
||||
]);
|
||||
]) || [];
|
||||
|
||||
const params = reactive({
|
||||
search: null,
|
||||
@@ -125,9 +125,7 @@
|
||||
};
|
||||
|
||||
const changeSearch = (data: any) => {
|
||||
console.log(data);
|
||||
params.current_page = 1;
|
||||
console.log(params);
|
||||
};
|
||||
|
||||
const viewData = (data: any) => {
|
||||
|
||||
Reference in New Issue
Block a user