update project shortener add/edit form to update data properly

pull/3/head
TZGyn 2 years ago
parent 39ed417ebd
commit e686806887
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -40,8 +40,6 @@
let previewData: any
let isPreviewLoading: boolean = false
$: $formData.link && getMetadata()
const getMetadata = async () => {
isPreviewLoading = true
clearTimeout(inputTimer)
@ -105,7 +103,8 @@
<Input
{...attrs}
bind:value={$formData.link}
placeholder="https://example.com" />
placeholder="https://example.com"
on:input={getMetadata} />
</Form.Control>
<Form.Description>Shortener link</Form.Description>
<Form.FieldErrors />

@ -12,7 +12,7 @@
import { toast } from 'svelte-sonner'
import { Loader2, LoaderCircle } from 'lucide-svelte'
import { Checkbox } from '$lib/components/ui/checkbox'
import { browser } from '$app/environment'
import { onMount } from 'svelte'
export let data: SuperValidated<Infer<FormSchema>>
@ -36,8 +36,6 @@
let previewData: any
let isPreviewLoading: boolean = false
$: $formData.link && browser && getMetadata()
const getMetadata = async () => {
isPreviewLoading = true
clearTimeout(inputTimer)
@ -53,6 +51,10 @@
console.log(previewData)
}, 1000)
}
onMount(() => {
getMetadata()
})
</script>
<div class="grid grid-cols-4 gap-4 items-center pb-4">
@ -83,7 +85,8 @@
<Input
{...attrs}
bind:value={$formData.link}
placeholder="https://example.com" />
placeholder="https://example.com"
on:input={getMetadata} />
</Form.Control>
<Form.Description>Shortener link</Form.Description>
<Form.FieldErrors />

@ -20,6 +20,7 @@ export const load = (async (event) => {
android: true,
android_link: true,
link: true,
active: true,
},
where: (shortener, { eq, and }) =>
and(

Loading…
Cancel
Save