Profile Component now accepts a user-object as paramter.

Started to implement the settings popup
This commit is contained in:
joschuatonn
2024-05-18 08:46:04 +02:00
parent e9b042a2ea
commit d19c441539
8 changed files with 240 additions and 60 deletions

View File

@@ -1,12 +1,13 @@
import { defineStore } from 'pinia';
import { chat } from 'src/models';
import {chat, responseModel} from 'src/models';
import { api } from 'src/boot/axios';
import { useUserStore } from 'stores/user-store';
export const useChatStore = defineStore('chatStore',{
state:() => ({
chats: [] as chat[],
chatsLoaded: false
chatsLoaded: false,
chatExistsReponse: false,
}),
actions: {
async getChatsByUser(): Promise<chat[]> {
@@ -33,6 +34,13 @@ export const useChatStore = defineStore('chatStore',{
}
console.log(members);
return (await api.post("/chats/create/" + chatName, members)).data;
},
async loadDoesChatExist(keycloakID : string, otherKeycloakID : string) : Promise<responseModel> {
return (await api.get("/chats/"+keycloakID+"/"+otherKeycloakID)).data;
},
doesChatExist(keycloakID : string, otherKeycloakID : string) {
this.loadDoesChatExist(keycloakID, otherKeycloakID)
.then(m => this.chatExistsReponse = m.success);
}
}
});

View File

@@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
import {api} from 'boot/axios';
import { ptpUser, responseModel, tenorResponseElement } from 'src/models';
import { tenorResponseElement } from 'src/models';
import Keycloak from 'keycloak-js';
export const useTenorStore = defineStore('tenorStore', {

View File

@@ -49,6 +49,17 @@ export const useUserStore = defineStore('userStore', {
getAllPtpUsers() {
this.loadAllPtpUsers().then((response : ptpUser[]) => {
this.users = response;
this.users.forEach((user : ptpUser) => {
if(user.profilePictureUrl == null) {
user.profilePictureUrl = "https://th.bing.com/th/id/R.487fe8708797950ab745a3800c31b7a4?rik=qW3zkDdZfweqmQ&pid=ImgRaw&r=0";
}
if(user.status == null) {
user.status = "Hey there, I am using ptpChat!";
}
})
this.usersLoaded = true;
})
},