Merge branch 'feat/handle-files' into dev
This commit is contained in:
@@ -16,7 +16,7 @@ import useAccountStore from "@/store/account";
|
||||
import { faCalendarDays } from "@fortawesome/free-regular-svg-icons";
|
||||
import usePermissions from "@/hooks/usePermissions";
|
||||
import { toast } from "react-hot-toast";
|
||||
import isValidUrl from "@/lib/client/isValidUrl";
|
||||
import isValidUrl from "@/lib/shared/isValidUrl";
|
||||
import Link from "next/link";
|
||||
import unescapeString from "@/lib/client/unescapeString";
|
||||
import { useRouter } from "next/router";
|
||||
@@ -43,7 +43,7 @@ export default function LinkCard({ link, count, className }: Props) {
|
||||
let shortendURL;
|
||||
|
||||
try {
|
||||
shortendURL = new URL(link.url).host.toLowerCase();
|
||||
shortendURL = new URL(link.url || "").host.toLowerCase();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -108,7 +108,8 @@ export default function LinkCard({ link, count, className }: Props) {
|
||||
response.ok && toast.success(`Link Deleted.`);
|
||||
};
|
||||
|
||||
const url = isValidUrl(link.url) ? new URL(link.url) : undefined;
|
||||
const url =
|
||||
isValidUrl(link.url || "") && link.url ? new URL(link.url) : undefined;
|
||||
|
||||
const formattedDate = new Date(link.createdAt as string).toLocaleString(
|
||||
"en-US",
|
||||
@@ -272,7 +273,7 @@ export default function LinkCard({ link, count, className }: Props) {
|
||||
) : undefined} */}
|
||||
|
||||
<Link
|
||||
href={link.url}
|
||||
href={link.url || ""}
|
||||
target="_blank"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
Reference in New Issue
Block a user