Refactor authentication middleware to use native fetch, update dependencies, and enhance error handling. Add new error boundary component for dashboard and improve user verification UI. Update payment handling and device management components for better user experience. Adjust CSS for error backgrounds and refine input read-only components with validation indicators.
This commit is contained in:
+24
-19
@@ -70,15 +70,16 @@ export async function Rejectuser({
|
||||
if (!user) {
|
||||
throw new Error("User not found");
|
||||
}
|
||||
|
||||
await SendUserRejectionDetailSMS({
|
||||
details: reason,
|
||||
phoneNumber: user.phoneNumber,
|
||||
});
|
||||
await prisma.user.delete({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
});
|
||||
await SendUserRejectionDetailSMS({
|
||||
details: reason,
|
||||
phoneNumber: user.phoneNumber,
|
||||
});
|
||||
revalidatePath("/users");
|
||||
redirect("/users");
|
||||
}
|
||||
@@ -90,21 +91,25 @@ export const SendUserRejectionDetailSMS = async ({
|
||||
details: string;
|
||||
phoneNumber: string;
|
||||
}) => {
|
||||
const respose = await fetch(`${process.env.SMS_API_BASE_URL}/api/sms`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${process.env.SMS_API_KEY}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
check_delivery: false,
|
||||
number: phoneNumber,
|
||||
message: details,
|
||||
}),
|
||||
});
|
||||
const data = await respose.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
try {
|
||||
const respose = await fetch(`${process.env.SMS_API_BASE_URL}/api/sms`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${process.env.SMS_API_KEY}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
check_delivery: false,
|
||||
number: phoneNumber,
|
||||
message: details,
|
||||
}),
|
||||
});
|
||||
const data = await respose.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
export async function AddDevice({
|
||||
|
||||
Reference in New Issue
Block a user