This file contains hidden or 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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Jest - All", | |
"program": "${workspaceFolder}/node_modules/jest/bin/jest", | |
"args": ["--no-cache"], | |
"console": "integratedTerminal", |
This file contains hidden or 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
const jwtDecode = require('jwt-decode') | |
const { pick } = require('lodash') | |
/** | |
* Pick properties from JWT | |
* | |
* @param {String} token JSON Web Token | |
* @param {String || Array} props Single property (String) or multiple properties (Array) | |
* | |
* @returns Object containing all props |
This file contains hidden or 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
import randomInt from 'random-int' | |
const REFRESH_INTERVAL = 2 * 60 * 1000 // ms | |
const REFRESH_TIME_OUT = 30 * 1000 // ms | |
export function refresh (refreshFn, interval = REFRESH_INTERVAL) { | |
let intervalToken | |
refreshFn() |
This file contains hidden or 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
import React from 'react'; | |
export default function withContext(Context) { | |
return (Component) => (props) => ( | |
<Context.Consumer> | |
{ context => <Component {...props} context={context} /> } | |
</Context.Consumer> | |
); | |
} |