mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix delete customer on demo page
This commit is contained in:
@@ -28,7 +28,12 @@ export default function DeleteCustomerModal({
|
||||
const deleteCustomerAction = async (e) => {
|
||||
setDeletingCustomer(true);
|
||||
e.preventDefault();
|
||||
await deleteCustomer(customerId, organisationId);
|
||||
const res = await deleteCustomer(customerId, organisationId);
|
||||
if (!res.ok) {
|
||||
toast.error("Something went wrong while deleting the user.");
|
||||
setOpen(false);
|
||||
return;
|
||||
}
|
||||
toast("User successfully deleted.");
|
||||
router.push(`/organisations/${organisationId}/customers`);
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ export const useCustomer = (organisationId: string, customerId: string) => {
|
||||
|
||||
export const deleteCustomer = async (email: string, organisationId: string) => {
|
||||
try {
|
||||
await fetch(`/api/organisations/${organisationId}/customers/${email}`, {
|
||||
return await fetch(`/api/organisations/${organisationId}/customers/${email}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user