This commit is contained in:
Ahmed Bouhuolia
2020-03-16 00:06:15 +02:00
parent 56701951b7
commit 73711384f6
7925 changed files with 18478 additions and 959 deletions

View File

@@ -0,0 +1,26 @@
import ApiService from "services/ApiService";
import t from 'store/types';
export const fetchCurrencies = () => {
return (dispatch) => new Promise((resolve, reject) => {
ApiService.get(`currencies/registered`).then((response) => {
dispatch({
type: t.CURRENCIES_REGISTERED_SET,
currencies: response.data.currencies,
});
resolve(response);
}).catch(error => { reject(error); });
});
};
export const fetchAllCurrencies = () => {
return (dispatch) => new Promise((resolve, reject) => {
ApiService.get(`currencies/all`).then((response) => {
dispatch({
type: t.CURRENCIES_ALL_SET,
currencies: response.data.currencies,
});
resolve(response);
}).catch(error => { reject(error); });
});
};

View File

@@ -0,0 +1,18 @@
import {createReducer} from '@reduxjs/toolkit'
import t from 'store/types';
const initialState = {
all: [],
registered: [],
};
export default createReducer(initialState, {
[t.CURRENCIES_REGISTERED_SET]: (state, action) => {
state.registered = action.currencies;
},
[t.CURRENCIES_ALL_SET]: (state, action) => {
state.all = action.currencies;
},
});

View File

@@ -0,0 +1,5 @@
export default {
CURRENCIES_REGISTERED_SET: 'CURRENCIES_REGISTERED_SET',
CURRENCIES_ALL_SET: 'CURRENCIES_ALL_SET',
};