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"; import React from "react";
export async function generateMetadata({ export async function generateMetadata() {
searchParams
}: {
searchParams: { id: string } | undefined;
}) {
return { return {
title: "Unsubscribe - SVR.JS", title: "Unsubscribe - SVR.JS",
description: "Unsubscribe from our newsletter.", description: "Unsubscribe from our newsletter.",
openGraph: { openGraph: {
title: "Unsubscribe - SVR.JS", title: "Unsubscribe - SVR.JS",
description: "Unsubscribe from our newsletter.", 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", type: "website",
images: [ images: [
{ {

View file

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

View file

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