Skip to content

Commit

Permalink
Fix thread publication
Browse files Browse the repository at this point in the history
  • Loading branch information
jbuget committed Sep 11, 2023
1 parent 6c7ce6b commit c7b1c61
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 253 deletions.
9 changes: 7 additions & 2 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@ function newThread() {
flex-direction: column;
}
.app-brand {}
.app-brand {
border-bottom: 1px solid lightgray;
display: flex;
align-items: center;
height: 60px;
}
.app-name {
font-weight: 800;
font-size: 2rem;
font-size: 1.5rem;
margin: 0.5rem;
}
Expand Down
8 changes: 4 additions & 4 deletions components/ThreadEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function publishThread(): Promise<void> {
if (thread.value && thread.value.messages) {
thread.value.id = await doSaveThread(thread.value)
const nonEmptyMessages = thread.value.messages.filter((message: any) => message.text.trim().length > 0 || message.attachments.length > 0)
await $fetch(`/api/threads/${thread.value.id}/publication`, { method: 'post', body: { messages: nonEmptyMessages } })
await $fetch(`/api/threads/${thread.value.id}/publication`, { method: 'post' })
toast.add({ severity: 'success', summary: 'Thread published', detail: `${nonEmptyMessages.length} posts published`, life: 3000 });
}
}
Expand Down Expand Up @@ -127,13 +127,13 @@ async function deleteThread(): Promise<void> {
<h2 class="thread-title">ID: {{ thread.id }}</h2>
<div class="thread-actions">
<div class="save">
<Button label="Save" icon="pi pi-save" severity="info" size="small" @click="saveThread" />
<Button icon="pi pi-save" severity="info" size="small" @click="saveThread" />
</div>
<div class="publish">
<Button label="Publish" icon="pi pi-send" severity="success" size="small" @click="publishThread" />
<Button icon="pi pi-send" severity="success" size="small" @click="publishThread" />
</div>
<div class="delete">
<Button label="Delete" icon="pi pi-trash" severity="danger" size="small" @click="deleteThread" />
<Button icon="pi pi-trash" severity="danger" size="small" @click="deleteThread" />
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion components/ThreadSummaryList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const emit = defineEmits<{
}>()
const selectThread = (threadId: number) => {
console.log(`Clicked item ${threadId}`)
emit('threadSelected', threadId);
}
Expand Down
241 changes: 0 additions & 241 deletions server/api/publications.post.ts

This file was deleted.

1 change: 0 additions & 1 deletion server/api/threads/[id].get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ export default defineEventHandler(async (event: any) => {
const [latest] = thread.versions.slice(-1)
result.latest = latest
}
console.log(result)
return result;
})
1 change: 0 additions & 1 deletion server/api/threads/[id].post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ export default defineEventHandler(async (event: any) => {
const [latest] = thread.versions.slice(-1)
result.latest = latest
}
console.log(result)
return result;
})
Loading

0 comments on commit c7b1c61

Please sign in to comment.