fix: fix type errors when building the website

This commit is contained in:
Dorian Niemiec 2024-09-08 14:57:02 +02:00
parent d4d040f9cb
commit dcaa81707b
3 changed files with 6 additions and 9 deletions

View file

@ -1,16 +1,12 @@
import React from "react";
export async function generateMetadata({
searchParams
}: {
searchParams: { id: string } | undefined;
}) {
export async function generateMetadata() {
return {
title: "Unsubscribe - SVR.JS",
description: "Unsubscribe from our newsletter.",
openGraph: {
title: "Unsubscribe - SVR.JS",
description: "Unsubscribe from our newsletter.",
url: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/unsubscribe/?id=${encodeURIComponent(searchParams ? searchParams.id : "")}`,
url: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/unsubscribe?id=`, // We can't use searchParams in layouts
type: "website",
images: [
{

View file

@ -16,14 +16,15 @@ export async function POST(req: NextRequest) {
};
const generateUniqueUnsubscribeID = async (collection: Collection) => {
const id = generateUnsubscribeID();
const id: string = generateUnsubscribeID();
const result = await collection
.find({
unsubscribeId: id
})
.toArray();
if (result.length > 0) {
return await generateUniqueUnsubscribeID(collection);
const newId: string = await generateUniqueUnsubscribeID(collection);
return newId;
}
return id;
};

View file

@ -36,7 +36,7 @@ export default function NumberTicker({
springValue.on("change", (latest) => {
if (ref.current) {
ref.current.textContent = Intl.NumberFormat("en-US").format(
latest.toFixed(0)
parseInt(latest.toFixed(0))
);
}
}),