lint fixes

This commit is contained in:
Ulf Gebhardt 2023-07-10 12:00:11 +02:00
parent 5f2cfdeab4
commit 8859aa56a4
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
3 changed files with 40 additions and 33 deletions

View File

@ -126,23 +126,23 @@ export default {
messagesLoaded: true,
showDemoOptions: true,
responsiveBreakpoint: 600,
singleRoom: !!this.singleRoomId || false
singleRoom: !!this.singleRoomId || false,
}
},
mounted() {
if(this.singleRoom){
if (this.singleRoom) {
this.$apollo
.mutate({
mutation: createRoom(),
variables: {
userId: this.singleRoomId
userId: this.singleRoomId,
},
})
.then((res) => {
.then(() => {
this.$apollo.queries.Rooms.refetch()
})
.catch(() => {
console.log(error)
.catch((error) => {
this.$toast.error(error)
})
.finally(() => {
// this.loading = false
@ -238,7 +238,7 @@ export default {
return roomQuery()
},
update({ Room }) {
console.log('Rooms', Room)
// console.log('Rooms', Room)
if (!Room) {
this.rooms = []
return
@ -249,10 +249,17 @@ export default {
// room[i].users[j].avatar.url -> room[i].users[j].avatar
// also filter rooms for the single room
this.rooms = Room.map((r) => {
return {...r, users: r.users.map((u) => { return {...u, username: u.name, avatar: u.avatar?.url}})}
}).filter((r) => this.singleRoom ? r.users.filter((u) => u.id === this.singleRoomId ).length > 0 : true)
return {
...r,
users: r.users.map((u) => {
return { ...u, username: u.name, avatar: u.avatar?.url }
}),
}
}).filter((r) =>
this.singleRoom ? r.users.filter((u) => u.id === this.singleRoomId).length > 0 : true,
)
console.log(this.rooms)
// console.log(this.rooms)
},
error(error) {
this.rooms = []

View File

@ -20,7 +20,7 @@
x
</ds-button>
</ds-text>
<chat-module :singleRoomId="$store.getters['chat/showChat'].roomID"/>
<chat-module :singleRoomId="$store.getters['chat/showChat'].roomID" />
</div>
>
</div>