react-native-cookies
react-native-cookies copied to clipboard
got undefined on set cookie response
@joeferraro
"react": "16.8.6", "react-native": "0.60.4", "react-native-cookies": "^3.3.0",
import CookieManager from 'react-native-cookies';
CookieManager.set({ name: 'myCookie', value: 'myValue', domain: 'some domain', origin: 'some origin', path: '/', version: '1', expiration: '2015-05-30T12:30:00.00-05:00' }).then((res) => { console.log('CookieManager.set =>', res); // undefined });
I have the same issue with @rahultatvasoft. Any idea ? Thanks.
The set method in the native module returns nil in every situation (whether it was a success or not), that's why it returns undefined in JS.
You can see here:
RNCookieManagerIOS.m / line 38
resolve(nil);
You can use the CookieManager.get and CookieManager.getAll (this one only on iOS) methods to get the cookies from storage and verify if the cookie was saved successfully.
I have forked the repo here: https://github.com/safaiyeh/react-native-cookie-store We can create issues and PRs there to continue the development of the project.