mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-06-19 21:18:35 -04:00
39 lines
737 B
JavaScript
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
|
|
};
|