mirror of
https://github.com/maputnik/editor.git
synced 2026-08-31 17:37:25 +00:00
Refactor sources modal
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
export function deleteSource(mapStyle, sourceId) {
|
||||
const remainingSources = { ...mapStyle.sources}
|
||||
delete remainingSources[sourceId]
|
||||
const changedStyle = {
|
||||
...mapStyle,
|
||||
sources: remainingSources
|
||||
}
|
||||
return changedStyle
|
||||
}
|
||||
|
||||
|
||||
export function addSource(mapStyle, sourceId, source) {
|
||||
return changeSource(mapStyle, sourceId, source)
|
||||
}
|
||||
|
||||
export function changeSource(mapStyle, sourceId, source) {
|
||||
const changedSources = {
|
||||
...mapStyle.sources,
|
||||
[sourceId]: source
|
||||
}
|
||||
const changedStyle = {
|
||||
...mapStyle,
|
||||
sources: changedSources
|
||||
}
|
||||
return changedStyle
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user