diff --git a/app/api/branches/route.ts b/app/api/branches/route.ts index 44a9d54..bad5c34 100644 --- a/app/api/branches/route.ts +++ b/app/api/branches/route.ts @@ -8,14 +8,18 @@ export async function GET() { }, }); - function groupByLocation({ - location, - ...rest - }: { - location: string | null | undefined; - }) { - return location === "Colombo" ? "Colombo" : location || "Unknown"; - } - const grouped = Object.groupBy(vehicles, groupByLocation); + const grouped = vehicles.reduce((acc: any, vehicle) => { + const key = + vehicle.location === "Colombo" + ? "Colombo" + : vehicle.location || "Unknown"; + + if (!acc[key]) { + acc[key] = []; + } + + acc[key].push(vehicle); + return acc; + }, {}); return Response.json(grouped); } diff --git a/lib/sendReviewEmail.ts b/lib/sendReviewEmail.ts index b1473a7..2f4d474 100644 --- a/lib/sendReviewEmail.ts +++ b/lib/sendReviewEmail.ts @@ -33,7 +33,7 @@ transporter.verify() .catch(err => console.error("ERROR:", err)); export const sendReviewEmail = async (to: string, token: string) => { - const reviewLink = `http://localhost:3000/customer-reviews?token=${token}`; + const reviewLink = `https://smartautohub.live/customer-reviews?token=${token}`; await transporter.sendMail({ from: `"Sameera Auto Traders" <${process.env.EMAIL_USER}>`,