File size: 700 Bytes
9a92a42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
import api from './axiosInstance.api';

interface LocationUpdatePayload {
    longitude: number;
    latitude: number;
}

interface LocationUpdateResponse {
    message: string;
}

const locationHistoryApi = {
    /**
     * Update user's current location
     * @param longitude - Longitude coordinate
     * @param latitude - Latitude coordinate
     */
    updateLocation: async (longitude: number, latitude: number): Promise<LocationUpdateResponse> => {
        const payload: LocationUpdatePayload = { longitude, latitude };
        const response = await api.post<LocationUpdateResponse>('/location/update', payload);
        return response.data;
    },
};

export default locationHistoryApi;