Some smaller changes
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
filled
|
||||
v-model="chatName"
|
||||
placeholder="Name des Chats"
|
||||
maxlength="256"
|
||||
counter
|
||||
style="margin: 20px 0;"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
@@ -115,11 +117,6 @@ import { useChatStore } from 'src/stores/chat-store';
|
||||
const createChat = () => {
|
||||
let errorOccured = false;
|
||||
|
||||
if(usersForChat.value.length == 0) {
|
||||
sendNotification("Du hast keine Mitglieder ausgewählt", false);
|
||||
errorOccured = true;
|
||||
}
|
||||
|
||||
if(chatName.value == "") {
|
||||
sendNotification("Du hast keinen Namen festgelegt", false);
|
||||
errorOccured = true;
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<q-card-section>
|
||||
<h5>Aktionen</h5>
|
||||
<q-btn @click="logout()" label="Abmelden" style="color:darkred;border:2px solid darkred;border-radius: 6px;width: 100%;margin-bottom: 14px;"/>
|
||||
<q-btn @click="logout()" label="Account privatisieren" style="color:darkred;border:2px solid darkred;border-radius: 6px;width: 100%;margin-bottom: 14px;"/>
|
||||
<q-btn @click="toggleSetPrivate()" :label="userStore.user!.isPrivate ? 'Account entprivatisieren' : 'Account privatisieren'" style="color:darkred;border:2px solid darkred;border-radius: 6px;width: 100%;margin-bottom: 14px;"/>
|
||||
<q-btn @click="deleteAccount()" label="Account löschen" style="color:darkred;border:2px solid darkred;border-radius: 6px;width: 100%;"/>
|
||||
</q-card-section>
|
||||
|
||||
@@ -126,6 +126,13 @@ import { sendNotification } from 'src/utils';
|
||||
// Hier muss ein request ans Backend geschickt werden, welcher den gesamten User enthält
|
||||
}
|
||||
|
||||
function toggleSetPrivate() {
|
||||
userStore.setPrivateForUser(userStore.user!.id, !userStore.user!.isPrivate).then((response : responseModel) => {
|
||||
userStore.user!.isPrivate = !userStore.user!.isPrivate;
|
||||
sendNotification(response.message, response.success);
|
||||
});
|
||||
}
|
||||
|
||||
const logout = () => {
|
||||
userStore.logout();
|
||||
};
|
||||
|
||||
@@ -44,6 +44,20 @@ export const useChatStore = defineStore('chatStore',{
|
||||
console.log(members);
|
||||
return (await api.post("/chats/create/" + chatName + "/" + keycloakID, members)).data;
|
||||
},
|
||||
async updateChat(chat : chat) {
|
||||
|
||||
const updatedChat : chat = {...chat};
|
||||
|
||||
this.profilePictures.forEach((element: profilePicture) => {
|
||||
if(element.url === updatedChat.profilepicture){
|
||||
updatedChat.profilepicture = element.shortName;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return (await api.post("/chats/update", chat)).data;
|
||||
},
|
||||
|
||||
async removeUserFromChat(keycloakID : string, chatID : number) {
|
||||
return (await api.delete("/chats/removeUser/"+chatID+"/"+keycloakID)).data;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,6 @@ export const useUserStore = defineStore('userStore', {
|
||||
},
|
||||
|
||||
async updateUser() {
|
||||
// Find corerspoding short name for link
|
||||
|
||||
const updatedUser : ptpUser = {...this.user!};
|
||||
|
||||
this.profilePictures.forEach((element: profilePicture) => {
|
||||
@@ -84,6 +82,10 @@ export const useUserStore = defineStore('userStore', {
|
||||
return (await api.post("/users/update", updatedUser)).data;
|
||||
},
|
||||
|
||||
async setPrivateForUser(keycloakId : string, isPrivate : boolean) {
|
||||
return (await api.post("/users/setPrivate/"+keycloakId+"/"+isPrivate)).data;
|
||||
},
|
||||
|
||||
async initKeycloak() : Promise<Keycloak>{
|
||||
|
||||
try {
|
||||
@@ -104,5 +106,6 @@ export const useUserStore = defineStore('userStore', {
|
||||
async logout() {
|
||||
window.location.href= 'http://localhost:' + keycloakPort + '/realms/' + realm + '/protocol/openid-connect/logout?post_logout_redirect_uri=http%3A%2F%2Flocalhost:' + frontendPort + '&client_id=' + clientId;
|
||||
},
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user