connect-to-spid-session
Advanced tools
Comparing version 0.0.2 to 0.0.3
# API: `connectToSpidSession` | ||
Higher order component, which wraps [SpidSessionStore](./SpidSessionStore.md) | ||
Higher order component, which wraps | ||
[SpidSessionStore](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/SpidSessionStore.md) | ||
and provide hooks for save and destroy of session. | ||
@@ -5,0 +6,0 @@ |
# API: `initializeSpidAction` | ||
`initializeSpidAction` send request to [SpidSessionStore](./SpidSessionStore.md) to initialize SPiD sdk | ||
and setup event handlers to keep track on user session. | ||
`initializeSpidAction` send request to | ||
[SpidSessionStore](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/SpidSessionStore.md) | ||
to initialize SPiD sdk and setup event handlers to keep track on user session. | ||
@@ -6,0 +7,0 @@ As payload you can pass all params supported by `init` method of SPiD sdk, |
# API: `logoutAction` | ||
Disconnect user with SPiD. `logoutAction` action takes no parameters and dispatches no actions directly. | ||
Change to session will be recorded by [SpidSessionStore](./SpidSessionStore.md) and all components connected | ||
to SPiD session will be updated. | ||
Change to session will be recorded by | ||
[SpidSessionStore](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/SpidSessionStore.md) | ||
and all components connected to SPiD session will be updated. | ||
@@ -7,0 +8,0 @@ Usage example: |
# API Documentation | ||
* [connectToSpidSession](./connectToSpidSession.md) | ||
* [initializeSpidAction](./initializeSpidAction.md) | ||
* [logoutAction](./logoutAction.md) | ||
* [restoreSessionAction](./restoreSessionAction.md) | ||
* [SpidSessionStore](./SpidSessionStore.md) | ||
* [connectToSpidSession](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/connectToSpidSession.md) | ||
* [initializeSpidAction](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/initializeSpidAction.md) | ||
* [logoutAction](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/logoutAction.md) | ||
* [restoreSessionAction](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/restoreSessionAction.md) | ||
* [SpidSessionStore](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/SpidSessionStore.md) |
@@ -16,2 +16,2 @@ # Save and restore session | ||
To use stored session data fire [restoreSessionAction](./api/restoreSessionAction.md) with session data as payload. | ||
To use stored session data fire [restoreSessionAction](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/restoreSessionAction.md) with session data as payload. |
{ | ||
"name": "connect-to-spid-session", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,5 +16,5 @@ # connect-to-spid-session | ||
* [Quick Start](./docs/quick-start.md) | ||
* [Save and restore](./docs/save-and-restore.md) | ||
* [API](./docs/api/README.md) | ||
* [Quick Start](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/quick-start.md) | ||
* [Save and restore](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/save-and-restore.md) | ||
* [API](https://bitbucket.org/teamhunch/connect-to-spid-session/src/master/docs/api/README.md) | ||
@@ -21,0 +21,0 @@ |
@@ -65,2 +65,6 @@ var createStore = require('fluxible/addons/createStore'); | ||
getUserId: function () { | ||
return this.data ? this.data.userId : null; | ||
}, | ||
dehydrate: function () { | ||
@@ -67,0 +71,0 @@ return { |
@@ -129,2 +129,30 @@ var chai = require('chai'); | ||
describe('getUserId', function () { | ||
it('should return id of user if logged in', function () { | ||
var sessionData = { | ||
userId: 5 | ||
}; | ||
var spidSessionStore = actionContext.getStore(SpidSessionStore); | ||
spidSessionStore.status = 'logged_in'; | ||
spidSessionStore.data = sessionData; | ||
var userId = spidSessionStore.getUserId(); | ||
expect(userId).to.equal(sessionData.userId); | ||
}); | ||
it('should return null if user isn\'t logged in', function () { | ||
var sessionData = null; | ||
var spidSessionStore = actionContext.getStore(SpidSessionStore); | ||
spidSessionStore.status = 'logged_out'; | ||
spidSessionStore.data = sessionData; | ||
var userId = spidSessionStore.getUserId(); | ||
expect(userId).to.equal(null); | ||
}); | ||
}); | ||
describe('handlers', function () { | ||
@@ -131,0 +159,0 @@ describe('SPID_INIT', function () { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75911
517