Skip to content

kietsy/react-native-cookies

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-cookies

Cookie manager for react native.

Installation

  1. npm install react-native-cookies
  2. In the XCode's "Project navigator", right click on project name folder ➜ Add Files to <...>
  • Ensure Copy items if needed and Create groups are checked
  1. Go to node_modulesreact-native-cookies ➜ add RNCookieManagerIOS folder
  2. Compile and have some cookies

Usage

var CookieManager = require('react-native-cookies');

// set a cookie
CookieManager.set({
  name: 'myCookie',
  value: 'myValue',
  domain: 'some domain',
  origin: 'some origin',
  path: '/',
  version: '1',
  expiration: '2015-05-30T12:30:00.00-05:00'
}, (err, res) => {
  console.log('cookie set!');
  console.log(err);
  console.log(res);
});

// list cookies
CookieManager.getAll((err, res) => {
  console.log('cookies!');
  console.log(err);
  console.log(res);
});

// clear cookies
CookieManager.clearAll((err, res) => {
  console.log('cookies cleared!');
  console.log(err);
  console.log(res);
});

Roadmap

  • Expose get method
  • Proper getAll dictionary by domain
  • Proper error handling
  • Anything else?

PR's welcome!

About

Cookie manager for React Native

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 71.3%
  • JavaScript 28.7%