Changed return values in order to be able to introduce error handling
This commit is contained in:
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia';
|
|||||||
import {chat, profilePicture, responseModel} from 'src/models';
|
import {chat, profilePicture, responseModel} from 'src/models';
|
||||||
import { api } from 'src/boot/axios';
|
import { api } from 'src/boot/axios';
|
||||||
import { useUserStore } from 'stores/user-store';
|
import { useUserStore } from 'stores/user-store';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
export const useChatStore = defineStore('chatStore',{
|
export const useChatStore = defineStore('chatStore',{
|
||||||
state:() => ({
|
state:() => ({
|
||||||
@@ -29,7 +30,7 @@ export const useChatStore = defineStore('chatStore',{
|
|||||||
});
|
});
|
||||||
this.profilePicturesLoaded = true;
|
this.profilePicturesLoaded = true;
|
||||||
},
|
},
|
||||||
async createChat(chatName: string, members: string[]){
|
async createChat(chatName: string, members: string[], keycloakID: string){
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
if(userStore.id) {
|
if(userStore.id) {
|
||||||
if (!members.includes(userStore.id)) {
|
if (!members.includes(userStore.id)) {
|
||||||
@@ -41,7 +42,10 @@ export const useChatStore = defineStore('chatStore',{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(members);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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<Keycloak>{
|
async initKeycloak() : Promise<Keycloak>{
|
||||||
|
|||||||
Reference in New Issue
Block a user