chat store now uses dedicated ProfilePicture model
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import {chat, 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';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ export const useChatStore = defineStore('chatStore',{
|
|||||||
chats: [] as chat[],
|
chats: [] as chat[],
|
||||||
chatsLoaded: false,
|
chatsLoaded: false,
|
||||||
chatExistsReponse: false,
|
chatExistsReponse: false,
|
||||||
profilePictures : [] as string[],
|
profilePictures : [] as profilePicture[],
|
||||||
profilePicturesLoaded: false
|
profilePicturesLoaded: false
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
@@ -24,7 +24,9 @@ export const useChatStore = defineStore('chatStore',{
|
|||||||
return this.chats;
|
return this.chats;
|
||||||
},
|
},
|
||||||
async loadProfilePictures(){
|
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;
|
this.profilePicturesLoaded = true;
|
||||||
},
|
},
|
||||||
async createChat(chatName: string, members: string[]){
|
async createChat(chatName: string, members: string[]){
|
||||||
|
|||||||
Reference in New Issue
Block a user