Parsing GPX files.
This commit is contained in:
1 parent
c545ff1d15
commit
a559a37952
20 files changed
+459
-21
No files matched your search
+2
-1
@@ -1,9 +1,10 @@
|
||||
import { configureStore } from '@reduxjs/toolkit';
|
||||
|
||||
import mapReducer from './map';
|
||||
import tracksReducer from './tracks';
|
||||
|
||||
const store = configureStore({
|
||||
reducer: { map: mapReducer },
|
||||
reducer: { map: mapReducer, tracks: tracksReducer },
|
||||
});
|
||||
|
||||
export default store;
|
||||
@@ -0,0 +1,29 @@
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
interface TracksState {
|
||||
index: number;
|
||||
tracks: { [index: string]: any };
|
||||
}
|
||||
|
||||
const initialTracks: TracksState = {
|
||||
index: 0,
|
||||
tracks: {},
|
||||
};
|
||||
|
||||
const tracksSlice = createSlice({
|
||||
name: 'tracks',
|
||||
initialState: initialTracks,
|
||||
reducers: {
|
||||
add: (state, action) => {
|
||||
state.tracks[action.payload.id] = action.payload.track;
|
||||
},
|
||||
push: (state, action) => {
|
||||
state.tracks['$' + state.index] = action.payload;
|
||||
state.index++;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const tracksActions = tracksSlice.actions;
|
||||
|
||||
export default tracksSlice.reducer;
|
||||
Reference in new issue
Block a user