Skip to content

Commit

Permalink
Fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
iyasinn committed Dec 2, 2024
1 parent f1ea342 commit be315dd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ interface DynamicLinkData {
image_url?: string;
}

interface UTMData {
tag: string;
}

interface Props {
initialRoute: string;
metadata: {
Expand All @@ -32,21 +36,20 @@ export const getServerSideProps: GetServerSideProps = async ({
const slugRoute = slug.join("/");

if (query.utm_tag) {
const utmTag = query.utm_tag;
console.log("UTM parameter detected:", utmTag);
const utmTag = query.utm_tag as string;

const { data: utmData } = await supabase
.from("utm")
const { data: utmData, error: utmError } = await supabase
.from<UTMData>("utm")
.select()
.eq("tag", utmTag)
.single();

if (utmData) {
if (utmError) {
console.log("Could not find any utm entry for tag: ", utmTag);
} else if (utmData) {
await supabase.from("utm_clicks").insert({
utm_tag: utmData.tag,
});
} else {
console.log("Could not find any utm entry for tag: ", utmTag);
}
}

Expand Down

0 comments on commit be315dd

Please sign in to comment.