mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-27 07:04:44 +02:00

UI contained lots of complex code for adding citybike and scooter to transport modes array. In the end, those were just filtered away before making a request. Most of the old mess is now cleaned away. There is still some strange code related to availableForSelection config switch; it should probably be erased as well.
33 lines
856 B
JavaScript
33 lines
856 B
JavaScript
import Store from 'fluxible/addons/BaseStore';
|
|
import {
|
|
getSearchSettingsStorage,
|
|
setSearchSettingsStorage,
|
|
} from './localStorage';
|
|
|
|
class RoutingSettingsStore extends Store {
|
|
static storeName = 'RoutingSettingsStore';
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
getRoutingSettings() {
|
|
let settings = getSearchSettingsStorage();
|
|
if (!settings) {
|
|
settings = {};
|
|
setSearchSettingsStorage(settings);
|
|
}
|
|
return settings;
|
|
}
|
|
|
|
saveRoutingSettings(changedSettings) {
|
|
const oldSettings = this.getRoutingSettings();
|
|
const newSettings = { ...oldSettings, ...changedSettings };
|
|
setSearchSettingsStorage(newSettings);
|
|
this.emitChange();
|
|
}
|
|
|
|
static handlers = {
|
|
saveRoutingSettings: 'saveRoutingSettings',
|
|
getRoutingSettings: 'getRoutingSettings',
|
|
};
|
|
}
|
|
|
|
export default RoutingSettingsStore;
|