@oxyhq/services
Version:
Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀
51 lines (47 loc) • 1.21 kB
JavaScript
;
/**
* Location Methods Mixin
*/
export function OxyServicesLocationMixin(Base) {
return class extends Base {
constructor(...args) {
super(...args);
}
/**
* Update user location
* @param latitude - Latitude coordinate
* @param longitude - Longitude coordinate
* @returns Location update result
*/
async updateLocation(latitude, longitude) {
try {
return await this.makeRequest('POST', '/api/location', {
latitude,
longitude
}, {
cache: false
});
} catch (error) {
throw this.handleError(error);
}
}
/**
* Get nearby users
* @param radius - Optional search radius in meters
* @returns Array of nearby users
*/
async getNearbyUsers(radius) {
try {
const params = radius ? {
radius
} : undefined;
return await this.makeRequest('GET', '/api/location/nearby', params, {
cache: false // Don't cache location data - always get fresh data
});
} catch (error) {
throw this.handleError(error);
}
}
};
}
//# sourceMappingURL=OxyServices.location.js.map