mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
lint fixes
This commit is contained in:
parent
5f2cfdeab4
commit
8859aa56a4
@ -126,23 +126,23 @@ export default {
|
|||||||
messagesLoaded: true,
|
messagesLoaded: true,
|
||||||
showDemoOptions: true,
|
showDemoOptions: true,
|
||||||
responsiveBreakpoint: 600,
|
responsiveBreakpoint: 600,
|
||||||
singleRoom: !!this.singleRoomId || false
|
singleRoom: !!this.singleRoomId || false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if(this.singleRoom){
|
if (this.singleRoom) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: createRoom(),
|
mutation: createRoom(),
|
||||||
variables: {
|
variables: {
|
||||||
userId: this.singleRoomId
|
userId: this.singleRoomId,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
this.$apollo.queries.Rooms.refetch()
|
this.$apollo.queries.Rooms.refetch()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((error) => {
|
||||||
console.log(error)
|
this.$toast.error(error)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
// this.loading = false
|
// this.loading = false
|
||||||
@ -234,33 +234,40 @@ export default {
|
|||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
Rooms: {
|
Rooms: {
|
||||||
query() {
|
query() {
|
||||||
return roomQuery()
|
return roomQuery()
|
||||||
},
|
|
||||||
update({ Room }) {
|
|
||||||
console.log('Rooms', Room)
|
|
||||||
if (!Room) {
|
|
||||||
this.rooms = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Backend result needs mapping of the following values
|
|
||||||
// room[i].users[j].name -> room[i].users[j].username
|
|
||||||
// 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)
|
|
||||||
|
|
||||||
console.log(this.rooms)
|
|
||||||
},
|
|
||||||
error(error) {
|
|
||||||
this.rooms = []
|
|
||||||
this.$toast.error(error.message)
|
|
||||||
},
|
|
||||||
fetchPolicy: 'cache-and-network',
|
|
||||||
},
|
},
|
||||||
|
update({ Room }) {
|
||||||
|
// console.log('Rooms', Room)
|
||||||
|
if (!Room) {
|
||||||
|
this.rooms = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Backend result needs mapping of the following values
|
||||||
|
// room[i].users[j].name -> room[i].users[j].username
|
||||||
|
// 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,
|
||||||
|
)
|
||||||
|
|
||||||
|
// console.log(this.rooms)
|
||||||
|
},
|
||||||
|
error(error) {
|
||||||
|
this.rooms = []
|
||||||
|
this.$toast.error(error.message)
|
||||||
|
},
|
||||||
|
fetchPolicy: 'cache-and-network',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
x
|
x
|
||||||
</ds-button>
|
</ds-button>
|
||||||
</ds-text>
|
</ds-text>
|
||||||
<chat-module :singleRoomId="$store.getters['chat/showChat'].roomID"/>
|
<chat-module :singleRoomId="$store.getters['chat/showChat'].roomID" />
|
||||||
</div>
|
</div>
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user