mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
Fix: PaymentReceive & ExchangeRate & itemCategories
This commit is contained in:
@@ -13,6 +13,7 @@ export const fetchExchangeRates = () => {
|
||||
});
|
||||
ApiService.get('exchange_rates')
|
||||
.then((response) => {
|
||||
|
||||
dispatch({
|
||||
type: t.EXCHANGE_RATE_LIST_SET,
|
||||
exchange_rates: response.data.exchange_rates.results,
|
||||
@@ -35,20 +36,18 @@ export const fetchExchangeRates = () => {
|
||||
export const submitExchangeRate = ({ form }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post('exchange_rates', form).then((response) => {
|
||||
resolve(response);
|
||||
}).catch((error)=>{
|
||||
const {response} = error
|
||||
const {data} = response;
|
||||
reject(data?.errors)
|
||||
})
|
||||
ApiService.post('exchange_rates', form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// export const deleteExchangeRate = (id) => {
|
||||
// return (dispatch) => ApiService.delete(`exchange_rates/${id}`);
|
||||
// }
|
||||
|
||||
export const deleteExchangeRate = (id) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import { pickItemsFromIds, getItemById } from 'store/selectors';
|
||||
|
||||
const exchangeRateItemsSelector = state => state.exchangeRates.exchangeRates;
|
||||
const exchangeRateItemsSelector = (state) => state.exchangeRates.exchangeRates;
|
||||
const exchangeRateIdPropSelector = (state, props) => props.exchangeRateId;
|
||||
|
||||
export const getExchangeRatesList = createSelector(
|
||||
exchangeRateItemsSelector,
|
||||
(exchangeRateItems) => {
|
||||
return Object.values(exchangeRateItems);
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
export const getExchangeRateById = createSelector(
|
||||
exchangeRateItemsSelector,
|
||||
exchangeRateIdPropSelector,
|
||||
(exchangeRates, exchangeRateId) => {
|
||||
return getItemById(exchangeRates, exchangeRateId);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user