Usage
import { AccountStorageMutation } from 'nr1'
Examples
Write document
1AccountStorageMutation.mutate({2 accountId: 1,3 actionType: AccountStorageMutation.ACTION_TYPE.WRITE_DOCUMENT,4 collection: 'myCollection',5 documentId: 'myDocumentId',6 document: {7 name: 'John',8 surname: 'Doe',9 },10});
Delete document
1AccountStorageMutation.mutate({2 accountId: 1,3 actionType: AccountStorageMutation.ACTION_TYPE.DELETE_DOCUMENT,4 collection: 'myCollection',5 documentId: 'myDocumentId',6});
Delete collection
1AccountStorageMutation.mutate({2 accountId: 1,3 actionType: AccountStorageMutation.ACTION_TYPE.DELETE_COLLECTION,4 collection: 'myCollection',5});
Props
Account identifier.
Type of action to perform.
<One ofAccountStorageMutation.ACTION_TYPE.DELETE_COLLECTION,AccountStorageMutation.ACTION_TYPE.DELETE_DOCUMENT,AccountStorageMutation.ACTION_TYPE.WRITE_DOCUMENT,>
Render prop function as children.
function (mutate: function, Function to trigger a mutation from your UI.
mutationResult: MutationResult Results of the
mutation.
) => React.ReactNode
Collection name.
NerdStorage document. Documents are restricted to 64 kB in size when JSON-stringified.
Document identifier to operate in. When omitted the whole collection is returned.
Methods
AccountStorageMutation.mutate
function (props: Object Object containing the mutation options. Any
AccountStorageMutation
prop is a valid option except children
.
) => PromiseQueryResult
Type definitions
PromiseQueryResult
{error: ApolloClient.ApolloError, Runtime error with graphQLErrors
and networkError
properties.
data: Object, Object containing the result of your query.
fetchMore: function|null, If not null
, fetchMore
allows you to
load more results for your query. New data is merged with previous
data.
refetch: function, Refetch the query.
}
MutationResult
{loading: boolean, Indicates that the request is in flight.
error: ApolloClient.ApolloError, Runtime error with graphQLErrors
and networkError
properties.
data: Object, Object containing the result of your mutation.
}