mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
chore: remove unused route
This commit is contained in:
-78
@@ -1,78 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { Back, Card } from '$lib/components';
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
import { collection } from '../store';
|
||||
import { doc } from './[document]/store';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import Document from './[document]/_document.svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import InputCustomId from '$lib/elements/forms/inputCustomId.svelte';
|
||||
import { Container, Cover } from '$lib/layout';
|
||||
import { base } from '$app/paths';
|
||||
|
||||
$: projectId = $page.params.project;
|
||||
|
||||
onMount(() => {
|
||||
doc.set({
|
||||
$collection: $page.params.collection,
|
||||
$id: null,
|
||||
$createdAt: null,
|
||||
$updatedAt: null,
|
||||
$read: [],
|
||||
$write: []
|
||||
});
|
||||
});
|
||||
|
||||
const createDocument = async () => {
|
||||
try {
|
||||
const created = await sdkForProject.databases.createDocument(
|
||||
$collection.$id,
|
||||
$doc.$id,
|
||||
{
|
||||
...$doc,
|
||||
$id: undefined
|
||||
},
|
||||
$doc.$read,
|
||||
$doc.$write
|
||||
);
|
||||
addNotification({
|
||||
message: 'Document was created!',
|
||||
type: 'success'
|
||||
});
|
||||
await goto(
|
||||
`${base}/console/${projectId}/database/collection/${created.$collection}/document/${created.$id}`
|
||||
);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Appwrite - Document</title>
|
||||
</svelte:head>
|
||||
{#if $doc && $collection}
|
||||
<Cover>
|
||||
<Back href={`${base}/console/${projectId}/database/collection/${$collection.$id}`}>
|
||||
Collection - {$collection.name}
|
||||
</Back>
|
||||
<h1>Create Document</h1>
|
||||
</Cover>
|
||||
<Container>
|
||||
<Card>
|
||||
<Form on:submit={createDocument}>
|
||||
<InputCustomId id="id" label="Document ID" bind:value={$doc.$id} />
|
||||
<Document />
|
||||
<Button submit>Create</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
</Container>
|
||||
{:else}
|
||||
<div aria-busy="true" />
|
||||
{/if}
|
||||
Reference in New Issue
Block a user