chat store now uses dedicated ProfilePicture model
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import {chat, responseModel} from 'src/models';
|
||||
import {chat, profilePicture, responseModel} from 'src/models';
|
||||
import { api } from 'src/boot/axios';
|
||||
import { useUserStore } from 'stores/user-store';
|
||||
|
||||
@@ -8,7 +8,7 @@ export const useChatStore = defineStore('chatStore',{
|
||||
chats: [] as chat[],
|
||||
chatsLoaded: false,
|
||||
chatExistsReponse: false,
|
||||
profilePictures : [] as string[],
|
||||
profilePictures : [] as profilePicture[],
|
||||
profilePicturesLoaded: false
|
||||
}),
|
||||
actions: {
|
||||
@@ -24,7 +24,9 @@ export const useChatStore = defineStore('chatStore',{
|
||||
return this.chats;
|
||||
},
|
||||
async loadProfilePictures(){
|
||||
this.profilePictures = (await api.get("/users/profilePictures")).data;
|
||||
(await api.get("/chats/profilePictures")).data.forEach((element: string) => {
|
||||
this.profilePictures.push({shortName: element.split(" ")[0].replace(":", ""), url: element.split(" ")[1]});
|
||||
});
|
||||
this.profilePicturesLoaded = true;
|
||||
},
|
||||
async createChat(chatName: string, members: string[]){
|
||||
|
||||
Reference in New Issue
Block a user