feat: add and close #104

This commit is contained in:
Xyphyn committed 2023-08-16 15:59:55 -07:00
1 parent b27a018bf3
commit db753ff6dc
2 files changed
+18 -10

No files matched your search

+18 -9
View File
@@ -73,14 +73,6 @@
communities = list.communities.map((c) => c.community)
}
const draft = getSessionStorage('postDraft')
if (draft && !edit) {
// @ts-ignore
draft.loading = false
// @ts-ignore
data = draft
}
})
onDestroy(() => {
@@ -250,13 +242,30 @@
previewButton
/>
<Checkbox bind:checked={data.nsfw}>NSFW</Checkbox>
<div class="mt-auto" />
{#if !edit}
<Button
on:click={() => {
const draft = getSessionStorage('postDraft')
if (draft && !edit) {
// @ts-ignore
draft.loading = false
// @ts-ignore
data = draft
}
}}
size="lg"
disabled={!getSessionStorage('postDraft')}
>
Restore from draft
</Button>
{/if}
<Button
submit
color="primary"
loading={data.loading}
size="lg"
disabled={data.loading}
class={$$props.class}
>
Submit
</Button>