feat: invalid url error handling

This commit is contained in:
Timothy J. Baek 2024-01-26 22:22:37 -08:00
parent 28226a6f97
commit 2f1f2b12b4

View file

@ -4,6 +4,7 @@
import { documents } from '$lib/stores'; import { documents } from '$lib/stores';
import { removeFirstHashWord, isValidHttpUrl } from '$lib/utils'; import { removeFirstHashWord, isValidHttpUrl } from '$lib/utils';
import { tick } from 'svelte'; import { tick } from 'svelte';
import toast from 'svelte-french-toast';
export let prompt = ''; export let prompt = '';
@ -92,6 +93,10 @@
const url = prompt.split(' ')?.at(0)?.substring(1); const url = prompt.split(' ')?.at(0)?.substring(1);
if (isValidHttpUrl(url)) { if (isValidHttpUrl(url)) {
confirmSelectWeb(url); confirmSelectWeb(url);
} else {
toast.error(
'Oops! Looks like the URL is invalid. Please double-check and try again.'
);
} }
}} }}
> >