fix for new discussions not appearing right away
This commit is contained in:
parent
66e7fa24a1
commit
914f6bdf36
@ -9,7 +9,7 @@
|
|||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
import { getDiscussions, currentDiscussion, fetchDiscussion, createDiscussion } from '@/rest/msg.js'
|
import { getDiscussions, currentDiscussion, fetchDiscussion, createDiscussion } from '@/rest/msg.js'
|
||||||
|
|
||||||
const discussionsList = ref(await getDiscussions());
|
const discussionsList = reactive(await getDiscussions());
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<div id="msg">
|
<div id="msg">
|
||||||
<div id="discList">
|
<div id="discList">
|
||||||
<div @click="fetchDiscussion(discussion.id)" class="discItem" v-for="discussion in discussionsList" :key="discussion.id">{{ discussion.name }}</div>
|
<div @click="fetchDiscussion(discussion.id)" class="discItem" v-for="discussion in discussionsList" :key="discussion.id">{{ discussion.name }}</div>
|
||||||
<button id="createDiscussion" @click="createDiscussion('New Discussion'); getDiscussions().then(e => { discussionsList = e; })">+</button>
|
<button id="createDiscussion" @click="createDiscussion('New Discussion').then( e => discussionsList.push(e) )">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="discussion">
|
<div id="discussion">
|
||||||
<h1 id=msgName >{{currentDiscussion.name}}</h1>
|
<h1 id=msgName >{{currentDiscussion.name}}</h1>
|
||||||
|
@ -73,7 +73,7 @@ export async function fetchDiscussion(id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function createDiscussion(name){
|
export async function createDiscussion(name){
|
||||||
restPost("/discussion", {name: name});
|
return restPost("/discussion", {name: name});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user