QC User & Admin Responsive : Menu Landing Page - Desa

This commit is contained in:
2025-10-02 00:10:33 +08:00
parent 63054cedf0
commit 8a6d8ed8db
70 changed files with 1839 additions and 1052 deletions

View File

@@ -46,12 +46,19 @@ function EditPejabatDesa() {
const profileData = await profileLandingPageState.pejabatDesa.findUnique.load(id);
if (profileData) {
// Initialize form data
setFormData({
name: profileData.name || '',
position: profileData.position || '',
imageId: profileData.imageId || null,
});
// Initialize edit state with profile data
profileLandingPageState.pejabatDesa.edit.initialize({
...profileData,
imageId: profileData.imageId || ''
});
if (profileData.image?.link) {
setPreviewImage(profileData.image.link);
}
@@ -110,7 +117,14 @@ function EditPejabatDesa() {
imageId = uploaded.id;
}
// Update global state only on submit
// Ensure we have the ID from the URL
const id = params?.id as string;
if (!id) {
throw new Error("ID tidak ditemukan");
}
// Update global state with the ID and form data
profileLandingPageState.pejabatDesa.edit.id = id;
profileLandingPageState.pejabatDesa.edit.form = {
...formData,
imageId: imageId || '', // Ensure imageId is always a string