Add account to antenna webui

This commit is contained in:
KMY 2023-04-25 10:30:30 +09:00
parent 69df23d8d9
commit 0d5a6adc43
20 changed files with 644 additions and 1 deletions

View file

@ -0,0 +1,25 @@
import {
ANTENNAS_FETCH_SUCCESS,
} from '../actions/antennas';
import { Map as ImmutableMap, fromJS } from 'immutable';
const initialState = ImmutableMap();
const normalizeAntenna = (state, antenna) => state.set(antenna.id, fromJS(antenna));
const normalizeAntennas = (state, antennas) => {
antennas.forEach(antenna => {
state = normalizeAntenna(state, antenna);
});
return state;
};
export default function antennas(state = initialState, action) {
switch(action.type) {
case ANTENNAS_FETCH_SUCCESS:
return normalizeAntennas(state, action.antennas);
default:
return state;
}
}