implemented /bookmark/<ID>/view
This commit is contained in:
32
frontend/src/routes/bookmark/View.svelte
Normal file
32
frontend/src/routes/bookmark/View.svelte
Normal file
@@ -0,0 +1,32 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import Bookmark from './Template.svelte';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import Editor from '../../Components/MarkdownEditor.svelte';
|
||||
import Template from './Template.svelte';
|
||||
|
||||
let bookmark = $state(null);
|
||||
let error = $state(null);
|
||||
let { id } = $props();
|
||||
|
||||
async function load(){
|
||||
const url = api(`bookmark/${id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
bookmark = await resp.json();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
onMount(load);
|
||||
</script>
|
||||
|
||||
{#if error}
|
||||
<span class="error">{error}</span>
|
||||
{/if}
|
||||
<Template {bookmark} />
|
||||
Reference in New Issue
Block a user