Refactor userPresence query and updateQuery function

This commit is contained in:
Douglas Barone 2024-01-19 12:08:37 -04:00
parent 0b09d098fd
commit 9829092229
2 changed files with 7 additions and 10 deletions

View File

@ -8,9 +8,9 @@ export async function userPresence(_, { search, onlyServants }) {
where: { where: {
wifiDevices: { some: { lastSeen: { not: null } } } wifiDevices: { some: { lastSeen: { not: null } } }
}, },
orderBy: { displayName: 'asc' },
include: { include: {
wifiDevices: { wifiDevices: {
orderBy: [{ lastSeen: 'desc' }],
include: { accessPoint: true } include: { accessPoint: true }
} }
} }

View File

@ -269,7 +269,6 @@
<script> <script>
import gql from 'graphql-tag' import gql from 'graphql-tag'
import Avatar from '@/components/Avatar' import Avatar from '@/components/Avatar'
import { debounce } from '../utils/debounce'
export default { export default {
name: 'UserPresence', name: 'UserPresence',
@ -363,14 +362,12 @@ export default {
}[status] }[status]
}, },
updateQuery() { updateQuery() {
debounce(() =>
this.$router.replace({ this.$router.replace({
query: { query: {
search: this.search || undefined, search: this.search || undefined,
onlyServants: this.onlyServants || undefined onlyServants: this.onlyServants || undefined
} }
}) })
)()
} }
} }
} }