mirror of
https://github.com/owntracks/frontend.git
synced 2026-08-25 20:47:16 +00:00
Merge branch 'master' into clean-up-the-typing-mess
This commit is contained in:
+13
-9
@@ -12,7 +12,7 @@ import { getApiUrl } from "@/util";
|
||||
*
|
||||
* @param {String} path API resource path
|
||||
* @param {Object} [params] Query parameters
|
||||
* @return {Promise} Promise returned by the fetch function
|
||||
* @returns {Promise} Promise returned by the fetch function
|
||||
*/
|
||||
const fetchApi = (path, params = {}) => {
|
||||
const url = getApiUrl(path);
|
||||
@@ -24,7 +24,7 @@ const fetchApi = (path, params = {}) => {
|
||||
/**
|
||||
* Get the recorder's version.
|
||||
*
|
||||
* @return {String} Version
|
||||
* @returns {String} Version
|
||||
*/
|
||||
export const getVersion = async () => {
|
||||
const response = await fetchApi("/api/0/version");
|
||||
@@ -36,7 +36,7 @@ export const getVersion = async () => {
|
||||
/**
|
||||
* Get all users.
|
||||
*
|
||||
* @return {Array.<User>} Array of usernames
|
||||
* @returns {Array.<User>} Array of usernames
|
||||
*/
|
||||
export const getUsers = async () => {
|
||||
const response = await fetchApi("/api/0/list");
|
||||
@@ -49,7 +49,8 @@ export const getUsers = async () => {
|
||||
* Get all devices for the provided users.
|
||||
*
|
||||
* @param {Array.<User>} users Array of usernames
|
||||
* @return {Object.<User, Array.<Device>>} Object mapping each username to an array of device names
|
||||
* @returns {Object.<User, Array.<Device>>}
|
||||
* Object mapping each username to an array of device names
|
||||
*/
|
||||
export const getDevices = async users => {
|
||||
const devices = {};
|
||||
@@ -69,7 +70,7 @@ export const getDevices = async users => {
|
||||
*
|
||||
* @param {User} [user] Get last locations of all devices from this user
|
||||
* @param {Device} [device] Get last location of specific device
|
||||
* @return {Array.<LastLocation>} Array of last location objects
|
||||
* @returns {Array.<LastLocation>} Array of last location objects
|
||||
*/
|
||||
export const getLastLocations = async (user, device) => {
|
||||
const params = {};
|
||||
@@ -91,7 +92,7 @@ export const getLastLocations = async (user, device) => {
|
||||
* @param {Device} device Device name
|
||||
* @param {String} start Start date and time in UTC
|
||||
* @param {String} end End date and time in UTC
|
||||
* @return {LocationHistory} Array of location history objects
|
||||
* @returns {LocationHistory} Array of location history objects
|
||||
*/
|
||||
export const getUserDeviceLocationHistory = async (
|
||||
user,
|
||||
@@ -113,10 +114,12 @@ export const getUserDeviceLocationHistory = async (
|
||||
/**
|
||||
* Get the location history of multiple devices.
|
||||
*
|
||||
* @param {Object.<User, Array.<Device>>} devices Devices of which the history should be fetched
|
||||
* @param {Object.<User, Array.<Device>>} devices
|
||||
* Devices of which the history should be fetched
|
||||
* @param {String} start Start date and time in UTC
|
||||
* @param {String} end End date and time in UTC
|
||||
* @return {Object.<User, Object.<Device, LocationHistory>>} Array of location history objects
|
||||
* @returns {Object.<User, Object.<Device, LocationHistory>>}
|
||||
* Array of location history objects
|
||||
*/
|
||||
export const getLocationHistory = async (devices, start, end) => {
|
||||
const locationHistory = {};
|
||||
@@ -139,7 +142,8 @@ export const getLocationHistory = async (devices, start, end) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Connect to the WebSocket API, reconnect when necessary and handle received messages.
|
||||
* Connect to the WebSocket API, reconnect when necessary and handle received
|
||||
* messages.
|
||||
*
|
||||
* @param {webSocketLocationCallback} [callback] Callback for location messages
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user