mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-05 06:05:12 -04:00
* Add typescript parser and fix Flow errors in JS files * Uninstall packages from react-native/eslint-config * Fix all flow errors (or ignore them for unknowns
48 lines
983 B
JavaScript
48 lines
983 B
JavaScript
// @flow
|
|
|
|
import inatjs from "inaturalistjs";
|
|
|
|
import handleError from "./error";
|
|
|
|
const setQualityMetric = async (
|
|
params: Object = {},
|
|
opts: Object = {}
|
|
): Promise<?Object> => {
|
|
try {
|
|
const response = await inatjs.observations.setQualityMetric( params, opts );
|
|
return response.results;
|
|
} catch ( e ) {
|
|
return handleError( e );
|
|
}
|
|
};
|
|
|
|
const deleteQualityMetric = async (
|
|
params: Object = {},
|
|
opts: Object = {}
|
|
): Promise<?Object> => {
|
|
try {
|
|
const { results } = await inatjs.observations.deleteQualityMetric( params, opts );
|
|
return results;
|
|
} catch ( e ) {
|
|
return handleError( e );
|
|
}
|
|
};
|
|
|
|
const fetchQualityMetrics = async (
|
|
params: Object = {},
|
|
opts: Object = {}
|
|
): Promise<?Object> => {
|
|
try {
|
|
const response = await inatjs.observations.qualityMetrics( params, opts );
|
|
return response.results;
|
|
} catch ( e ) {
|
|
return handleError( e );
|
|
}
|
|
};
|
|
|
|
export {
|
|
deleteQualityMetric,
|
|
fetchQualityMetrics,
|
|
setQualityMetric
|
|
};
|