Add account to antenna webui
This commit is contained in:
parent
69df23d8d9
commit
0d5a6adc43
20 changed files with 644 additions and 1 deletions
25
app/javascript/mastodon/reducers/antennas.js
Normal file
25
app/javascript/mastodon/reducers/antennas.js
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue