add comment explaining reducer

This commit is contained in:
Tainan Felipe 2018-05-14 16:34:06 -03:00
parent 84b2342fef
commit a4b9bc807e

View File

@ -35,6 +35,8 @@ export function joinRouteHandler(nextState, replace, callback) {
const metakeys = metadata.length
? metadata.reduce((acc, meta) => {
const key = Object.keys(meta).shift();
/* this reducer tranform array of objects in a sigle object and
force the metadata a be boolean value */
return { ...acc, [key]: JSON.parse(meta[key]) };
}) : {};
SessionStorage.setItem(METADATA_KEY, metakeys);