Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-isomorphic-tools

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-isomorphic-tools - npm Package Compare versions

Comparing version 2.0.8 to 2.0.9

reducers/immutable/authentication.js

8

constants/index.js

@@ -27,2 +27,8 @@ 'use strict';

var NAVIGATOR_SET_LOCALE = exports.NAVIGATOR_SET_LOCALE = '@@navigator/setLocale';
var NAVIGATOR_SET_USER_AGENT = exports.NAVIGATOR_SET_USER_AGENT = '@@navigator/setUserAgent';
var NAVIGATOR_SET_USER_AGENT = exports.NAVIGATOR_SET_USER_AGENT = '@@navigator/setUserAgent';
// Auth
var AUTH_LOGIN_SUCCESS = exports.AUTH_LOGIN_SUCCESS = '@@authentication/loginSuccess';
var AUTH_LOGOUT_SUCCESS = exports.AUTH_LOGOUT_SUCCESS = '@@authentication/logoutSuccess';
var AUTH_ACCOUNT_SUCCESS = exports.AUTH_ACCOUNT_SUCCESS = '@@authentication/accountSuccess';

2

package.json
{
"name": "react-isomorphic-tools",
"version": "2.0.8",
"version": "2.0.9",
"description": "Authorization, Fetcher, Preload. Tools for ServerSide rendering",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -6,21 +6,23 @@ 'use strict';

});
exports.ImmutableAuthentication = undefined;
exports.authentication = undefined;
var _immutable = require('immutable');
var _extends2 = require('babel-runtime/helpers/extends');
var _immutable2 = _interopRequireDefault(_immutable);
var _extends3 = _interopRequireDefault(_extends2);
var _constants = require('../constants');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ImmutableAuthentication = function ImmutableAuthentication() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _immutable2.default.Map({});
var authentication = function authentication() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var action = arguments[1];
switch (action.type) {
case 'LOGIN_SUCCESS':
return state.set('user', _immutable2.default.fromJS(action.payload));
case 'LOGOUT_SUCCESS':
return state.set('user', null);
case 'ACCOUNT_SUCCESS':
return state.set('user', _immutable2.default.fromJS(action.payload));
case _constants.AUTH_LOGIN_SUCCESS:
return (0, _extends3.default)({}, state, { user: action.payload });
case _constants.AUTH_LOGOUT_SUCCESS:
return (0, _extends3.default)({}, state, { user: null });
case _constants.AUTH_ACCOUNT_SUCCESS:
return (0, _extends3.default)({}, state, { user: action.payload });
default:

@@ -31,2 +33,2 @@ return state;

exports.ImmutableAuthentication = ImmutableAuthentication;
exports.authentication = authentication;

@@ -6,3 +6,3 @@ 'use strict';

});
exports.ImmutableFetchData = exports.fetchData = undefined;
exports.fetchData = undefined;

@@ -17,6 +17,2 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty');

var _immutable = require('immutable');
var _immutable2 = _interopRequireDefault(_immutable);
var _constants = require('../constants');

@@ -42,4 +38,3 @@

isFetching: false,
error: false,
_request: undefined
error: false
})));

@@ -57,35 +52,2 @@ case _constants.FETCH_TO_STATE_FAIL:

var ImmutableFetchData = function ImmutableFetchData() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _immutable2.default.fromJS({});
var action = arguments[1];
switch (action.type) {
case _constants.FETCH_TO_STATE_REQUEST:
return state.mergeIn([action.meta.key], _immutable2.default.fromJS({
_request: action.payload.request,
isFetching: true,
isFetched: false,
error: false
}));
case _constants.FETCH_TO_STATE_SUCCESS:
return state.set(action.meta.key, _immutable2.default.fromJS((0, _extends6.default)({}, action.payload, {
isFetched: true,
isFetching: false,
error: false
})));
case _constants.FETCH_TO_STATE_FAIL:
return state.set(action.meta.key, {
error: action.payload.error,
isFetching: false,
isFetched: false
});
default:
return state;
}
};
exports.fetchData = fetchData;
exports.ImmutableFetchData = ImmutableFetchData;
exports.fetchData = fetchData;

@@ -6,24 +6,37 @@ 'use strict';

});
exports.ImmutableModals = exports.fetchData = exports.authentication = undefined;
var _modals = require('./modals');
var _authentication = require('./authentication');
Object.defineProperty(exports, 'ImmutableModals', {
Object.defineProperty(exports, 'authentication', {
enumerable: true,
get: function get() {
return _modals.ImmutableModals;
return _authentication.authentication;
}
});
var _authentication2 = require('./authentication');
var _fetchData = require('./fetchData');
var _authentication3 = _interopRequireDefault(_authentication2);
Object.defineProperty(exports, 'fetchData', {
enumerable: true,
get: function get() {
return _fetchData.fetchData;
}
});
var _fetchData2 = require('./fetchData');
var _navigator = require('./navigator');
var _fetchData3 = _interopRequireDefault(_fetchData2);
Object.defineProperty(exports, 'navigator', {
enumerable: true,
get: function get() {
return _navigator.navigator;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _modals = require('./modals');
exports.authentication = _authentication3.default;
exports.fetchData = _fetchData3.default;
Object.defineProperty(exports, 'modals', {
enumerable: true,
get: function get() {
return _modals.modals;
}
});

@@ -6,8 +6,12 @@ 'use strict';

});
exports.ImmutableModals = undefined;
exports.modals = undefined;
var _immutable = require('immutable');
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _immutable2 = _interopRequireDefault(_immutable);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends4 = require('babel-runtime/helpers/extends');
var _extends5 = _interopRequireDefault(_extends4);
var _constants = require('../constants');

@@ -18,3 +22,3 @@

var modals = function modals() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _immutable2.default.Map({});
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var action = arguments[1];

@@ -24,7 +28,7 @@

case _constants.MODALS_OPEN:
return state.set(action.meta, true);
return (0, _extends5.default)({}, state, (0, _defineProperty3.default)({}, action.meta, true));
case _constants.MODALS_CLOSE:
return state.set(action.meta, false);
return (0, _extends5.default)({}, state, (0, _defineProperty3.default)({}, action.meta, false));
case _constants.MODALS_CLOSE_ALL:
return _immutable2.default.Map({});
return {};
default:

@@ -35,2 +39,2 @@ return state;

exports.ImmutableModals = modals;
exports.modals = modals;

@@ -6,7 +6,7 @@ 'use strict';

});
exports.ImmutableNavigator = undefined;
exports.navigator = undefined;
var _immutable = require('immutable');
var _extends2 = require('babel-runtime/helpers/extends');
var _immutable2 = _interopRequireDefault(_immutable);
var _extends3 = _interopRequireDefault(_extends2);

@@ -17,4 +17,4 @@ var _constants = require('../constants');

var ImmutableNavigator = function ImmutableNavigator() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _immutable2.default.Map({});
var navigator = function navigator() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var action = arguments[1];

@@ -24,5 +24,5 @@

case _constants.NAVIGATOR_SET_USER_AGENT:
return state.set('userAgent', action.payload);
return (0, _extends3.default)({}, state, { userAgent: action.payload });
case _constants.NAVIGATOR_SET_LOCALE:
return state.set('locale', action.payload);
return (0, _extends3.default)({}, state, { locale: action.payload });
default:

@@ -33,2 +33,2 @@ return state;

exports.ImmutableNavigator = ImmutableNavigator;
exports.navigator = navigator;

@@ -22,2 +22,8 @@ //Fetcher

export const NAVIGATOR_SET_LOCALE = '@@navigator/setLocale'
export const NAVIGATOR_SET_USER_AGENT = '@@navigator/setUserAgent'
export const NAVIGATOR_SET_USER_AGENT = '@@navigator/setUserAgent'
// Auth
export const AUTH_LOGIN_SUCCESS = '@@authentication/loginSuccess'
export const AUTH_LOGOUT_SUCCESS = '@@authentication/logoutSuccess'
export const AUTH_ACCOUNT_SUCCESS = '@@authentication/accountSuccess'

@@ -1,11 +0,11 @@

import Immutable from 'immutable'
import {AUTH_ACCOUNT_SUCCESS, AUTH_LOGIN_SUCCESS, AUTH_LOGOUT_SUCCESS} from '../constants'
const ImmutableAuthentication = (state = Immutable.Map({}), action) => {
const authentication = (state = {}, action) => {
switch (action.type) {
case 'LOGIN_SUCCESS':
return state.set('user', Immutable.fromJS(action.payload))
case 'LOGOUT_SUCCESS':
return state.set('user', null)
case 'ACCOUNT_SUCCESS':
return state.set('user', Immutable.fromJS(action.payload))
case AUTH_LOGIN_SUCCESS:
return {...state, user: action.payload}
case AUTH_LOGOUT_SUCCESS:
return {...state, user: null}
case AUTH_ACCOUNT_SUCCESS:
return {...state, user: action.payload}
default:

@@ -16,2 +16,2 @@ return state

export {ImmutableAuthentication}
export {authentication}

@@ -1,2 +0,1 @@

import Immutable from 'immutable'
import {FETCH_TO_STATE_REQUEST, FETCH_TO_STATE_SUCCESS, FETCH_TO_STATE_FAIL} from '../constants'

@@ -23,3 +22,2 @@

error: false,
_request: undefined
}

@@ -41,32 +39,4 @@ }

const ImmutableFetchData = (state = Immutable.fromJS({}), action) => {
switch (action.type) {
case FETCH_TO_STATE_REQUEST:
return state.mergeIn([action.meta.key], Immutable.fromJS({
_request: action.payload.request,
isFetching: true,
isFetched: false,
error: false
}))
case FETCH_TO_STATE_SUCCESS:
return state.set(action.meta.key, Immutable.fromJS({
...action.payload,
isFetched: true,
isFetching: false,
error: false,
}))
case FETCH_TO_STATE_FAIL:
return state.set(action.meta.key, {
error: action.payload.error,
isFetching: false,
isFetched: false,
})
default:
return state
}
}
export {fetchData, ImmutableFetchData}
export {
fetchData
}

@@ -1,3 +0,4 @@

export authentication from './authentication'
export fetchData from './fetchData'
export {ImmutableModals} from './modals'
export {authentication} from './authentication'
export {fetchData} from './fetchData'
export {navigator} from './navigator'
export {modals} from './modals'

@@ -1,12 +0,11 @@

import Immutable from 'immutable'
import {MODALS_OPEN, MODALS_CLOSE, MODALS_CLOSE_ALL} from '../constants'
const modals = (state = Immutable.Map({}), action)=> {
const modals = (state = {}, action)=> {
switch (action.type) {
case MODALS_OPEN:
return state.set(action.meta, true)
return {...state, [action.meta]: true}
case MODALS_CLOSE:
return state.set(action.meta, false)
return {...state, [action.meta]: false}
case MODALS_CLOSE_ALL:
return Immutable.Map({})
return {}
default:

@@ -17,2 +16,4 @@ return state

export {modals as ImmutableModals}
export {
modals
}

@@ -1,10 +0,9 @@

import Immutable from 'immutable'
import {NAVIGATOR_SET_LOCALE, NAVIGATOR_SET_USER_AGENT} from '../constants'
const ImmutableNavigator = (state = Immutable.Map({}), action) => {
const navigator = (state = {}, action) => {
switch (action.type) {
case NAVIGATOR_SET_USER_AGENT:
return state.set('userAgent', action.payload)
return {...state, userAgent: action.payload}
case NAVIGATOR_SET_LOCALE:
return state.set('locale', action.payload)
return {...state, locale: action.payload}
default:

@@ -16,3 +15,3 @@ return state

export {
ImmutableNavigator
navigator
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc