Merge pull request 'Delete Account & Support Center fix' (#13) from fix-mobile/18-nov-25 into staging

Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/13
This commit is contained in:
2025-11-18 14:04:14 +08:00
5 changed files with 78 additions and 42 deletions

View File

@@ -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.
## [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.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17)

View File

@@ -1,6 +1,6 @@
{
"name": "hipmi",
"version": "1.5.14",
"version": "1.5.15",
"private": true,
"prisma": {
"seed": "bun prisma/seed.ts"

View File

@@ -20,6 +20,7 @@ export default function DeleteAccount() {
const [data, setData] = useState({
description: "",
});
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
// Hanya di client, setelah mount
@@ -31,15 +32,32 @@ export default function DeleteAccount() {
}, []);
const handlerSubmit = async () => {
if (!phoneNumber || !data.description) {
if (!phoneNumber) {
return notifications.show({
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",
});
}
try {
setIsLoading(true);
const response = await fetch("/api/helper/delete-account", {
method: "POST",
headers: {
@@ -67,12 +85,14 @@ export default function DeleteAccount() {
if (!result.success) {
notifications.show({
title: "Error",
message: result.error,
message: result.error || "Failed to delete account.",
color: "red",
});
}
} catch (error) {
console.log(error);
} finally {
setIsLoading(false);
}
};
@@ -121,7 +141,7 @@ export default function DeleteAccount() {
/>
</Grid.Col>
<Grid.Col span={4}>
<Button onClick={handlerSubmit} w={"100%"}>
<Button onClick={handlerSubmit} w={"100%"} loading={isLoading}>
Submit
</Button>
</Grid.Col>

View File

@@ -1,15 +1,15 @@
"use client";
import {
Box,
Button,
Group,
Paper,
SimpleGrid,
Stack,
Text,
Textarea,
TextInput,
Title
Box,
Button,
Group,
Paper,
SimpleGrid,
Stack,
Text,
Textarea,
TextInput,
Title,
} from "@mantine/core";
import { notifications } from "@mantine/notifications";
import { IconBrandGmail, IconLocation } from "@tabler/icons-react";
@@ -22,6 +22,7 @@ export default function SupportCenter() {
title: "",
description: "",
});
const [isLoading, setLoading] = useState(false);
const handleSubmit = async () => {
if (!data.email || !data.title || !data.description) {
@@ -32,35 +33,43 @@ export default function SupportCenter() {
});
}
const response = await fetch("/api/helper/support-center", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
const result = await response.json();
try {
setLoading(true);
if (result.success) {
notifications.show({
title: "Success",
color: "green",
message: "Message sent successfully.",
const response = await fetch("/api/helper/support-center", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
const result = await response.json();
setData({
email: "",
title: "",
description: "",
});
}
if (result.success) {
notifications.show({
title: "Success",
color: "green",
message: "Message sent successfully.",
});
if (!result.success) {
notifications.show({
title: "Error",
color: "red",
message: result.error,
});
setData({
email: "",
title: "",
description: "",
});
}
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
</Button>
</Stack>

View File

@@ -18,7 +18,8 @@ export async function POST(req: Request) {
const data = await resend.emails.send({
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,
html: `
<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">