diff --git a/src/stores/chat-store.ts b/src/stores/chat-store.ts index 4e8a60d..393a812 100644 --- a/src/stores/chat-store.ts +++ b/src/stores/chat-store.ts @@ -2,6 +2,7 @@ import { defineStore } from 'pinia'; import {chat, profilePicture, responseModel} from 'src/models'; import { api } from 'src/boot/axios'; import { useUserStore } from 'stores/user-store'; +import { useQuasar } from 'quasar'; export const useChatStore = defineStore('chatStore',{ state:() => ({ @@ -29,7 +30,7 @@ export const useChatStore = defineStore('chatStore',{ }); this.profilePicturesLoaded = true; }, - async createChat(chatName: string, members: string[]){ + async createChat(chatName: string, members: string[], keycloakID: string){ const userStore = useUserStore(); if(userStore.id) { if (!members.includes(userStore.id)) { @@ -41,7 +42,10 @@ export const useChatStore = defineStore('chatStore',{ } } console.log(members); - return (await api.post("/chats/create/" + chatName, members)).data; + return (await api.post("/chats/create/" + chatName + "/" + keycloakID, members)).data; + }, + async removeUserFromChat(keycloakID : string, chatID : number) { + return (await api.delete("/chats/removeUser/"+chatID+"/"+keycloakID)).data; } } }); diff --git a/src/stores/user-store.ts b/src/stores/user-store.ts index cbb51e9..1f3d942 100644 --- a/src/stores/user-store.ts +++ b/src/stores/user-store.ts @@ -81,7 +81,7 @@ export const useUserStore = defineStore('userStore', { }); - await api.post("/users/update", updatedUser); + return (await api.post("/users/update", updatedUser)).data; }, async initKeycloak() : Promise{