Skip to content
Snippets Groups Projects
Commit 35f76828 authored by Sander August Heggland Schrader's avatar Sander August Heggland Schrader
Browse files

Made it so string is cleared once a message is sent

parent ae068a8a
No related branches found
No related tags found
1 merge request!40Chat
......@@ -71,8 +71,6 @@ export default {
},
async sendMessage() {
const token = this.$store.state.user.token;
// Post new message to server /chats/users/{userId}/messages
await axios.post(process.env.VUE_APP_BASEURL + `chats/users/${this.recipientID}/messages`, {
message: this.message
}, {
......@@ -80,11 +78,12 @@ export default {
Authorization: `Bearer ${token}`
}
})
this.message = "";
ws.sendMessage({ sender: parseInt(this.userid), recipient: this.recipientID });
this.reloadMessages();
},
async reloadMessages() {
const token = this.$store.state.user.token;
const token = this.$store.state.user.token;
const response = await fetch(`${process.env.VUE_APP_BASEURL}chats/users/${this.recipientID}/messages`, {
method: "GET",
headers: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment