Commit f0303f73 by Nguyễn Thị Thúy

Merge branch 'phase2_tool' into 'dev_phase2'

integrate convert unit api

See merge request !14
parents 9d789f65 ff6fbf64
......@@ -14,6 +14,11 @@ import DeviceInfo from 'react-native-device-info';
import R from './assets/R';
import {WIDTHXD, HEIGHTXD} from './Config/Functions';
import DropdownManager from './components/DropdownAlert/DropdownManager';
import AsyncStorage from '@react-native-community/async-storage';
import KEY from './assets/AsynStorage';
import I18n, {setLocation} from './helper/i18/i18n';
import {changeLanguage} from './actions/language';
enableScreens();
......@@ -23,11 +28,16 @@ const RootView = (props) => {
dropDownAlertRef.current,
dropDownAlertLongTimeRef.current,
);
setInitLanguage()
}, []);
const dropDownAlertRef = useRef(null);
const dropDownAlertLongTimeRef = useRef(null);
const setInitLanguage = async () => {
const laguage = await AsyncStorage.getItem(KEY.LANGUAGE);
if (laguage) props.changeLanguage(laguage);
setLocation(I18n, laguage);
};
return (
<>
<View style={{flex: 1}}>
......@@ -85,4 +95,4 @@ const mapStateToProps = (state) => {
};
};
export default connect(mapStateToProps, {})(RootView);
export default connect(mapStateToProps, {changeLanguage})(RootView);
......@@ -79,7 +79,7 @@ const CaculatedStopLoss = (props) => {
if (res.status == 200 && res.data.code == 200) {
setDataProduct(res.data.data);
} else {
showAlert(TYPE.ERROR, I18n.t('Notification', I18n.t('Can_not_get_data')));
showAlert(TYPE.ERROR, I18n.t('Notification'), I18n.t('Can_not_get_data'));
}
};
......
......@@ -67,7 +67,7 @@ const CalculatorProfitLoss = (props) => {
});
props.hideLoading();
if (res.status == 200 && res.data.code == 200) {
const newList = [res.data.data].concat(dataCalculator);
const newList = [res.data.data].concat([...dataCalculator]);
setDataCalculator(newList);
setLotTransactionNumber(null);
setOpenPrice(null);
......
......@@ -112,7 +112,7 @@ const CalculatorProfitLossView = (props) => {
</View>
<FlatList
style={{paddingBottom: HEIGHTXD(15), backgroundColor: R.colors.white}}
keyExtractor={(item) => item.id}
keyExtractor={(item) => item}
data={props.dataCalculator}
renderItem={({item, index}) => (
<ItemCalculator
......
......@@ -41,7 +41,7 @@ const ExchangeRate = (props) => {
if (res.status == 200 && res.data.code == 200) {
setDataProduct(res.data.data);
} else {
showAlert(TYPE.ERROR, I18n.t('Notification', I18n.t('Can_not_get_data')));
showAlert(TYPE.ERROR, I18n.t('Notification'), I18n.t('Can_not_get_data'));
}
};
......
......@@ -26,3 +26,8 @@ export const getListExchangeRate = async (body) =>
GetData(url.urlGetListExchangeRate, body)
.then((res) => res)
.catch((err) => err);
export const getUnitList = async (body) =>
GetData(url.urlGetUnitList, body)
.then((res) => res)
.catch((err) => err);
......@@ -57,4 +57,6 @@ export default {
urlProfitLost: root + 'api/v1/customers/calculate-profit',
urlGetListExchangeRate: root + 'api/v1/customers/get-list-exchange-rate',
urlGetUnitList: `${root}api/v1/customers/get-list-unit`,
};
......@@ -18,7 +18,7 @@ import Test from '../Screens/NewFeed/Test';
import {useNavigation} from '@react-navigation/native';
import Transaction from '../Screens/Transaction/Transaction';
import {AccountVerification, PACKETCQG} from '../routers/ScreenNames';
import I18n from '../helper/i18/i18n';
import I18n, {setLocation} from '../helper/i18/i18n';
import {changeLanguage} from '../actions/language';
import KEY from '../assets/AsynStorage';
import AsyncStorage from '@react-native-community/async-storage';
......@@ -77,6 +77,7 @@ const TabNavigator = (props) => {
const setInitLanguage = async () => {
const laguage = await AsyncStorage.getItem(KEY.LANGUAGE);
if (laguage) props.changeLanguage(laguage);
setLocation(I18n, laguage);
};
const showPopUp = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment