Skip to content

Commit 0cbab21

Browse files
committed
Update utils.ts
1 parent 1d21595 commit 0cbab21

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

netlify/edge-functions/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export async function generateShortUrl(longUrl: string): Promise<string> {
3737
throw error;
3838
}
3939
if (data && data[0]?.short_url) {
40+
console.log("data");
41+
console.log(data);
4042
return data[0].short_url;
4143
}
4244
let shortUrl: string;
@@ -51,9 +53,9 @@ export async function generateShortUrl(longUrl: string): Promise<string> {
5153
console.error("Error checking for collision:", error);
5254
throw error;
5355
}
56+
console.log("data");
5457
console.log(data);
55-
console.log(error);
56-
isCollision = data.length > 0;
58+
isCollision = !!data;
5759
}
5860
({ data, error } = await fetchFromSupabase("urls", {
5961
method: "POST",

0 commit comments

Comments
 (0)