Returns an instance of Roc
, initialized with the API URL and database
configured at build time.
- Fetches information about the authenticated user using:
- Fetches the given sample using:
Internally calls useSample
and permits to access the main sample from anywhere in the children
Tries to get the main sample id from the iframe bridge, or from the query string.
Query a CouchDB view. For example useRocQuery('sample_toc')
would query https://mydb.cheminfo.org/db/eln/_query/sample_toc
Options examples:
- https://mydb.cheminfo.org/db/eln/_query/sample_toc?mine=1
- https://mydb.cheminfo.org/db/eln/_query/sample_toc?groups=groupCreator
- Get an attachment URL by name
- Save a sample
useSampleToc
?- handle changes, to know if sample is still unsaved
dirty
field- function to update in-memory copy -> update((draft) => { draft.x = y })
- function to revert in-memory changes
- detect server-side change of sample (polling revision id with HEAD ?)
- re-fetch
Reference: https://github.com/cheminfo-js/visualizer-helper/blob/master/eln/Sample.js
- All requests
- No connection
- Not found
- No access (unauthenticated for example)