mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 12:58:35 +03:00
adjust selectors to handle array of sources
This commit is contained in:
@@ -12,7 +12,7 @@ const eventSchema = Joi.object().keys({
|
||||
type: Joi.string().allow(''),
|
||||
category: Joi.string().required(),
|
||||
narrative: Joi.string().allow(''),
|
||||
source: Joi.string().allow(''),
|
||||
sources: Joi.array(),
|
||||
tags: Joi.string().allow(''),
|
||||
comments: Joi.string().allow(''),
|
||||
timestamp: Joi.string().required(),
|
||||
|
||||
@@ -165,12 +165,14 @@ export const selectSelected = createSelector(
|
||||
return []
|
||||
}
|
||||
const srcs = selected
|
||||
.map(e => e.source)
|
||||
.map(id => sources[id])
|
||||
.map(e => e.sources)
|
||||
.map(_sources =>
|
||||
_sources.map(id => sources[id])
|
||||
)
|
||||
|
||||
return selected.map((s, idx) => ({
|
||||
...s,
|
||||
source: srcs[idx]
|
||||
sources: srcs[idx]
|
||||
}))
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user