Files
iNaturalistReactNative/src/api/flags.js
Angie e14d620992 301 flag id functionality obsdetail (#333)
* Flag Id Modal created.

* Flag item modal radio buttons, styling, cancel button

* Flag Item Modal, Api Flags file created

* Added id field in Identifications realm schema, Flag Item Modal API call

* Clear form, toggle function, click title not just checkbox to toggle

* Fixed android checkbox toggle.

* Clean up. Flag ID ObsDetail. Closes #301.

* Flag realm model, flagged status shown on initial load

* Refresh observation after item flagged. In Progress.

* Remove console logs, add onError

* save button loading spinner

* Realm 31 migration for obsservation updated_at

* Flags test file

* FlagItemModal tests

* FlagItemModal tests

---------

Co-authored-by: Amanda Bullington <albullington@gmail.com>
2023-02-03 13:09:56 -08:00

24 lines
406 B
JavaScript

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