File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -29,21 +29,23 @@ async function main() {
2929 } , 200 ) ,
3030 ) ;
3131
32- // parse image config
33- // @ts -expect-error - TODO: validate config
34- const config : vizarr . ImageLayerConfig = { } ;
35-
36- for ( const [ key , value ] of url . searchParams ) {
37- // @ts -expect-error - TODO: validate config
38- config [ key ] = value ;
39- }
40-
4132 // We want to addImage() for each source in the query params
4233 const sources = url . searchParams . getAll ( "source" ) ;
43- sources . forEach ( ( source ) => {
44- // deepcopy config
34+ sources . forEach ( ( source , index ) => {
35+ // parse image config
36+ // @ts -expect-error - TODO: validate config
37+ const config : vizarr . ImageLayerConfig = { } ;
38+
39+ for ( const [ key , value ] of url . searchParams ) {
40+ // get all the values for key...
41+ const values = url . searchParams . getAll ( key ) ;
42+ if ( values . length > index ) {
43+ // @ts -expect-error - TODO: validate config
44+ config [ key ] = values [ index ] ;
45+ }
46+ }
4547 let configCopy = JSON . parse ( JSON . stringify ( config ) ) ;
46- configCopy [ ' source' ] = source ;
48+ configCopy . source = source ;
4749 viewer . addImage ( configCopy ) ;
4850 } ) ;
4951
You can’t perform that action at this time.
0 commit comments