-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hi
Can you add a parameter in saveSession and saveUser Method to set cookie expiry manually instead of assigning at the initial level.
Because consider this use-case. In Login form there is a option called "RememberMe". if the user select this option means we have to set expiry to future date. So for this type of use-case if you allow this default parameter means it will be helpful.
key: 'saveUser',
value: function saveUser(user, expires=null) {
return new Promise(function (resolve) {
if (instance.server) {
instance[_constants.USER_DATA] = user;
instance.store.dispatch((0, _actions.getUserSessionSuccess)(user));
resolve();
} else if (instance.driver === 'COOKIES') {
Cookies.set(_constants.USER_DATA, user, { expires: expires == null ? instance.expires : expires });
instance.store.dispatch((0, _actions.getUserSessionSuccess)(user));
resolve();
} else {
instance.storage.setItem(_constants.USER_DATA, user).then(function (user) {
instance.store.dispatch((0, _actions.getUserSessionSuccess)(user));
resolve();
}).catch(function () {
instance.store.dispatch((0, _actions.getUserSessionSuccess)(user));
Cookies.set(_constants.USER_DATA, user, { expires: expires == null ? instance.expires : expires });
resolve();
});
}
});
}
}
Thanks,
Velu