blob: fda1a1ffc9fb3d324192fc5d83746c43b93c7089 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import HttpClient from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
/**
* Sends a heartbeat
*
* @param {boolean} isAway Whether or not the user is active
* @return {Promise<void>}
*/
const sendHeartbeat = async (isAway) => {
const url = generateOcsUrl('apps/user_status/api/v1/heartbeat?format=json')
const response = await HttpClient.put(url, {
status: isAway ? 'away' : 'online',
})
return response.data.ocs.data
}
export {
sendHeartbeat,
}
|