);
}
// Send the friend request
let status: ResultStatus;
let message: string;
try {
const sent = await sendFriendRequest(id);
if (sent === false) {
status = "error";
message =
"Could not send friend request. It may already exist.";
} else {
status = "success";
message = `Friend request sent to ${targetUser.name}!`;
}
} catch {
status = "error";
message = "Something went wrong. Please try again.";
}
return (
);
}
function ResultCard({
status,
message,
}: Readonly<{
status: ResultStatus;
message: string;
}>) {
const isSuccess = status === "success";
const isAlreadyFriends = status === "already_friends";
return (