mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
24 lines
571 B
JavaScript
24 lines
571 B
JavaScript
import { createReducer } from '@reduxjs/toolkit';
|
|
import t from 'store/types';
|
|
|
|
const initialState = {
|
|
exchangeRates: {},
|
|
};
|
|
|
|
export default createReducer(initialState, {
|
|
[t.EXCHANGE_RATE_LIST_SET]: (state, action) => {
|
|
const _exchangeRates = {};
|
|
action.exchange_rates.forEach((exchange_rate) => {
|
|
_exchangeRates[exchange_rate.id] = exchange_rate;
|
|
});
|
|
|
|
state.exchangeRates = {
|
|
...state.exchangeRates,
|
|
..._exchangeRates,
|
|
};
|
|
},
|
|
[t.EXCHANGE_RATE_TABLE_LOADING]: (state, action) => {
|
|
state.loading = action.loading;
|
|
},
|
|
});
|