perbaikan fixing insert issue

This commit is contained in:
AJISETIAJI
2025-06-04 23:49:45 +07:00
parent 77c50cb12c
commit 9f7556b11d
2 changed files with 51 additions and 14 deletions

View File

@@ -183,6 +183,28 @@
created_at: string;
};
type issueInsert = {
name: string;
villa_id: string;
area_of_villa: string;
priority: string;
issue_type: string;
issue_number: string;
move_issue: boolean;
description_of_the_issue: string;
reported_date: string;
issue_related_image: string;
issue_source: string;
reported_by: string;
input_by: string;
guest_communication: string;
resolution: string;
guest_has_aggreed_issue_has_been_resolved: boolean;
follow_up: boolean;
need_approval: boolean;
created_at: string;
};
async function handleSubmit(event: Event): Promise<void> {
event.preventDefault();
@@ -198,7 +220,7 @@
if (issueImageFile) {
const { data, error } = await supabase.storage
.from("villabugis")
.upload(`issue/${issueImageFile.name}`, issueImageFile);
.upload(`issues/${issueImageFile.name}`, issueImageFile);
if (error) {
console.error("Error uploading image:", error);
@@ -208,9 +230,9 @@
issueImageUrl = data.path; // Assuming data.Key contains the URL or path to the uploaded image
}
const issue: Issue = {
const issue: issueInsert = {
name: formData.get("name") as string,
villa_name: formData.get("villa_name") as string,
villa_id: formData.get("villa_name") as string,
area_of_villa: formData.get("area_of_villa") as string,
priority: formData.get("priority") as string,
issue_type: formData.get("issue_type") as string,