-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from performant-software/feature/cdc157_list_…
…columns CDC #157 - List Columns
- Loading branch information
Showing
17 changed files
with
280 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// @flow | ||
|
||
const SESSION_DEFAULT = '{}'; | ||
|
||
/** | ||
* Restores the list session from the passed storage object. | ||
* | ||
* @param key | ||
* @param storage | ||
* | ||
* @returns {{}|any} | ||
*/ | ||
const restoreSession = (key, storage) => { | ||
if (!(key && storage)) { | ||
return {}; | ||
} | ||
|
||
const session = storage.getItem(key) || SESSION_DEFAULT; | ||
return JSON.parse(session); | ||
}; | ||
|
||
/** | ||
* Sets the passed list session on the passed storage object. | ||
* | ||
* @param key | ||
* @param storage | ||
* @param session | ||
*/ | ||
const setSession = (key, storage, session) => { | ||
if (!(key && storage)) { | ||
return; | ||
} | ||
|
||
const currentSession = restoreSession(key, storage); | ||
storage.setItem(key, JSON.stringify({ ...currentSession, ...session })); | ||
}; | ||
|
||
export default { | ||
restoreSession, | ||
setSession | ||
}; |
Oops, something went wrong.