refactor(board): accept refresh params in useBoardPosts mutators
This commit is contained in:
parent
61d33f5db3
commit
698f786951
2 changed files with 7 additions and 8 deletions
|
|
@ -17,29 +17,29 @@ export function useBoardPosts() {
|
|||
}
|
||||
}
|
||||
|
||||
async function createPost(body) {
|
||||
async function createPost(body, refreshParams = {}) {
|
||||
const created = await $fetch('/api/board/posts', {
|
||||
method: 'POST',
|
||||
body,
|
||||
})
|
||||
await fetchPosts()
|
||||
await fetchPosts(refreshParams)
|
||||
return created
|
||||
}
|
||||
|
||||
async function updatePost(id, body) {
|
||||
async function updatePost(id, body, refreshParams = {}) {
|
||||
const updated = await $fetch(`/api/board/posts/${id}`, {
|
||||
method: 'PATCH',
|
||||
body,
|
||||
})
|
||||
await fetchPosts()
|
||||
await fetchPosts(refreshParams)
|
||||
return updated
|
||||
}
|
||||
|
||||
async function deletePost(id) {
|
||||
async function deletePost(id, refreshParams = {}) {
|
||||
const result = await $fetch(`/api/board/posts/${id}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
await fetchPosts()
|
||||
await fetchPosts(refreshParams)
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue