Files
iNaturalistReactNative/src/api/identifications.js
2023-09-12 19:04:24 -07:00

39 lines
737 B
JavaScript

// @flow
import inatjs from "inaturalistjs";
import handleError from "./error";
const PARAMS = {
fields: "all"
};
const createIdentification = async (
params: Object = {},
opts: Object = {}
): Promise<any> => {
try {
const { results } = await inatjs.identifications.create( { ...PARAMS, ...params }, opts );
return results;
} catch ( e ) {
return handleError( e );
}
};
const updateIdentification = async (
params: Object = {},
opts: Object = {}
): Promise<any> => {
try {
const { results } = await inatjs.identifications.update( { ...PARAMS, ...params }, opts );
return results;
} catch ( e ) {
return handleError( e );
}
};
export {
createIdentification,
updateIdentification
};