Enregistrez, supprimez ou mettez à jour un document défini par l'utilisateur dans NerdStorage.
Usage
import { UserStorageMutation } from 'nr1'
Exemples
Rédiger un document
UserStorageMutation.mutate({ actionType: UserStorageMutation.ACTION_TYPE.WRITE_DOCUMENT, collection: 'myCollection', documentId: 'myDocumentId', document: { name: 'John', surname: 'Doe', },});
Supprimer le document
UserStorageMutation.mutate({ actionType: UserStorageMutation.ACTION_TYPE.DELETE_DOCUMENT, collection: 'myCollection', documentId: 'myDocumentId',});
Supprimer la collection
UserStorageMutation.mutate({ actionType: UserStorageMutation.ACTION_TYPE.DELETE_COLLECTION, collection: 'myCollection',});
Accessoires
OBLIGATOIREénumération | Type d'action à réaliser. <One of |
OBLIGATOIREfonction | Rendre la fonction prop comme des enfants. function ( |
chaîne | Nom de la collection. |
objet | Document NerdStorage. Les documents sont limités à une taille de 64 Ko lorsqu'ils sont convertis en chaîne JSON. |
chaîne | Document identifiant pour opérer. En cas d'omission, la collection entière est renvoyée. |
Méthodes
UserStorageMutation.mutate
function (props: Object Object containing the mutation options. Any UserStorageMutation
prop is a valid option except children
.
) => PromiseQueryResult
Définitions de types
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.
}