Delete Account & Support Center fix #13
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.5.15](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.14...v1.5.15) (2025-11-18)
|
||||||
|
|
||||||
## [1.5.14](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.13...v1.5.14) (2025-11-17)
|
## [1.5.14](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.13...v1.5.14) (2025-11-17)
|
||||||
|
|
||||||
## [1.5.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17)
|
## [1.5.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hipmi",
|
"name": "hipmi",
|
||||||
"version": "1.5.14",
|
"version": "1.5.15",
|
||||||
"private": true,
|
"private": true,
|
||||||
"prisma": {
|
"prisma": {
|
||||||
"seed": "bun prisma/seed.ts"
|
"seed": "bun prisma/seed.ts"
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export default function DeleteAccount() {
|
|||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
description: "",
|
description: "",
|
||||||
});
|
});
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Hanya di client, setelah mount
|
// Hanya di client, setelah mount
|
||||||
@@ -31,15 +32,32 @@ export default function DeleteAccount() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handlerSubmit = async () => {
|
const handlerSubmit = async () => {
|
||||||
if (!phoneNumber || !data.description) {
|
if (!phoneNumber) {
|
||||||
return notifications.show({
|
return notifications.show({
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: "Please fill in description & phone number",
|
message: "Please check your phone number",
|
||||||
|
color: "red",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data.description) {
|
||||||
|
return notifications.show({
|
||||||
|
title: "Error",
|
||||||
|
message: "Please fill in description with 'Delete Account'",
|
||||||
|
color: "red",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.description !== "Delete Account") {
|
||||||
|
return notifications.show({
|
||||||
|
title: "Error",
|
||||||
|
message: "Please fill in description with 'Delete Account'",
|
||||||
color: "red",
|
color: "red",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
const response = await fetch("/api/helper/delete-account", {
|
const response = await fetch("/api/helper/delete-account", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -67,12 +85,14 @@ export default function DeleteAccount() {
|
|||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: result.error,
|
message: result.error || "Failed to delete account.",
|
||||||
color: "red",
|
color: "red",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -121,7 +141,7 @@ export default function DeleteAccount() {
|
|||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
<Button onClick={handlerSubmit} w={"100%"}>
|
<Button onClick={handlerSubmit} w={"100%"} loading={isLoading}>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Group,
|
Group,
|
||||||
Paper,
|
Paper,
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
Textarea,
|
Textarea,
|
||||||
TextInput,
|
TextInput,
|
||||||
Title
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { notifications } from "@mantine/notifications";
|
import { notifications } from "@mantine/notifications";
|
||||||
import { IconBrandGmail, IconLocation } from "@tabler/icons-react";
|
import { IconBrandGmail, IconLocation } from "@tabler/icons-react";
|
||||||
@@ -22,6 +22,7 @@ export default function SupportCenter() {
|
|||||||
title: "",
|
title: "",
|
||||||
description: "",
|
description: "",
|
||||||
});
|
});
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
if (!data.email || !data.title || !data.description) {
|
if (!data.email || !data.title || !data.description) {
|
||||||
@@ -32,35 +33,43 @@ export default function SupportCenter() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch("/api/helper/support-center", {
|
try {
|
||||||
method: "POST",
|
setLoading(true);
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data),
|
|
||||||
});
|
|
||||||
const result = await response.json();
|
|
||||||
|
|
||||||
if (result.success) {
|
const response = await fetch("/api/helper/support-center", {
|
||||||
notifications.show({
|
method: "POST",
|
||||||
title: "Success",
|
headers: {
|
||||||
color: "green",
|
"Content-Type": "application/json",
|
||||||
message: "Message sent successfully.",
|
},
|
||||||
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
|
const result = await response.json();
|
||||||
|
|
||||||
setData({
|
if (result.success) {
|
||||||
email: "",
|
notifications.show({
|
||||||
title: "",
|
title: "Success",
|
||||||
description: "",
|
color: "green",
|
||||||
});
|
message: "Message sent successfully.",
|
||||||
}
|
});
|
||||||
|
|
||||||
if (!result.success) {
|
setData({
|
||||||
notifications.show({
|
email: "",
|
||||||
title: "Error",
|
title: "",
|
||||||
color: "red",
|
description: "",
|
||||||
message: result.error,
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
if (!result.success) {
|
||||||
|
notifications.show({
|
||||||
|
title: "Error",
|
||||||
|
color: "red",
|
||||||
|
message: result.error || "Failed to send message.",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -177,7 +186,11 @@ export default function SupportCenter() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button color="yellow" onClick={() => handleSubmit()}>
|
<Button
|
||||||
|
loading={isLoading}
|
||||||
|
color="yellow"
|
||||||
|
onClick={() => handleSubmit()}
|
||||||
|
>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ export async function POST(req: Request) {
|
|||||||
|
|
||||||
const data = await resend.emails.send({
|
const data = await resend.emails.send({
|
||||||
from: `${email} <onboarding@resend.dev>`,
|
from: `${email} <onboarding@resend.dev>`,
|
||||||
to: ["bip.baliinteraktifperkasa@gmail.com"], // ganti sesuai email kamu
|
to: ["bagasbanuna02@gmail.com"],
|
||||||
|
// to: ["bip.baliinteraktifperkasa@gmail.com"],
|
||||||
subject: title,
|
subject: title,
|
||||||
html: `
|
html: `
|
||||||
<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">
|
<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">
|
||||||
|
|||||||
Reference in New Issue
Block a user