Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
createUrlObject
Browse files Browse the repository at this point in the history
  • Loading branch information
sametcn99 committed Feb 4, 2024
1 parent fbc7cbc commit 6e27e24
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ export const getSiteUrl = (): string => {
return baseUrl;
};

export const createUrlObject = (link: string): URL => {
export const createUrlObject = (link: string) => {
if (!link) {
throw new Error("Link is empty");
}
let newLink = link.startsWith("http") ? link : `https://${link}`;
// Ensure 'link' is a string before calling 'startsWith'
let newLink =
typeof link === "string" && link.startsWith("http")
? link
: `https://${link}`;
let url = new URL(newLink);
return url;
};

// utils.ts dosyasında fetchContact fonksiyonunu güncelle
export async function fetchContact(
username: string,
option: string,
page: number, // Sayfa numarası parametresi ekle
page: number,
signal: AbortSignal,
): Promise<UserData[] | []> {
try {
Expand Down

1 comment on commit 6e27e24

@vercel
Copy link

@vercel vercel bot commented on 6e27e24 Feb 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.