url validation
This commit is contained in:
@@ -8,6 +8,7 @@ import { useRecoilValue } from "recoil";
|
||||
import { useAuth } from "../../contexts/authContext";
|
||||
import { selectedConvoAtom } from "../../recoil/main";
|
||||
import LinkIcon, { getFavicon } from "./LinkIcon";
|
||||
import isValidHttpUrl from "@nirvana/common/helpers/urlHelper";
|
||||
|
||||
export default function CreateItemModal(props: {
|
||||
pastedLink: string;
|
||||
@@ -54,6 +55,12 @@ export default function CreateItemModal(props: {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValidHttpUrl(linkVal)) {
|
||||
toast.error("not a valid url");
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// service to add link to the collection
|
||||
// change the cacheddraweritem on the convo doc
|
||||
const newLink = new Link(linkDesc, linkVal, currUser!.uid);
|
||||
|
||||
Reference in New Issue
Block a user