feat: basic publish (#13)
This commit is contained in:
parent
0dda5c9b15
commit
787a55bea7
2 changed files with 24 additions and 6 deletions
|
@ -1,12 +1,26 @@
|
|||
<script setup lang="ts">
|
||||
const masto = await useMasto()
|
||||
|
||||
let draftPost = $ref('')
|
||||
let isSending = $ref(false)
|
||||
|
||||
async function publish() {
|
||||
try {
|
||||
isSending = true
|
||||
await masto.statuses.create({ status: draftPost })
|
||||
draftPost = ''
|
||||
}
|
||||
finally {
|
||||
isSending = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div flex flex-col gap-4>
|
||||
<textarea p2 border-rounded w-full h-40 color-black placeholder="What's on your mind?" />
|
||||
<div flex flex-col gap-4 :class="isSending ? ' pointer-events-none' : ''">
|
||||
<textarea v-model="draftPost" p2 border-rounded w-full h-40 color-black placeholder="What's on your mind?" />
|
||||
<div flex justify-end>
|
||||
<button h-9 w-22 bg-primary border-rounded>
|
||||
<button h-9 w-22 bg-primary border-rounded :disabled="draftPost === ''" @click="publish">
|
||||
Publish!
|
||||
</button>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue