mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
WIP / exchangeRate / localize
This commit is contained in:
20
client/src/store/ExchangeRate/exchange.reducer.js
Normal file
20
client/src/store/ExchangeRate/exchange.reducer.js
Normal file
@@ -0,0 +1,20 @@
|
||||
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,
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user