An example for integration of an apollo link to queue mutations when offline
The apollo link handles each request to the server (query or mutation) by saving into a queue if we're offline and also makes the queue persistent into cache memory. To make this happen as we wish, we have to know a little bit more information about each request, that's why the "context" prop should also be given along mutation/query, variables and optimisticResponse. The context takes an object with one of these keys 'isQuery', 'isCreate' or 'skip' with a boolean value.
Install these prerequisites before cloning the project.
curl https://install.meteor.com/ | sh
brew install yarn
A step by step guide on how to get a development env running
Clone the project
git clone https://[email protected]/cultofcoders/react-native-offline.git
Install dependencies for each one (server and client)
Server
cd microservices/api/app/ && npm install
Client
cd react-native && yarn
Run the server
cd microservices/api/app/ && meteor npm start
Run the client bundler
cd react-native && yarn start:ios
Run the client app
cd react-native && yarn ios:dev
Add additional notes about how to deploy this on a live system
- Meteor - The server framework used
- React Native - The mobile framework used
- npm - Package Management
- yarn - Package Management
- Marian Iordache - Initial work - Summys
This project is licensed under the MIT License - see the LICENSE.md file for details