Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Giang Tran
InvestCustomer
Commits
4a87b671
Commit
4a87b671
authored
May 12, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug post image
parent
c3631d0b
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
476 additions
and
196 deletions
+476
-196
package.json
package.json
+2
-1
Profile.js
src/Screens/AccountVerification/Tab/Profile.js
+91
-50
OTPWallet.js
src/Screens/Action/Wallet/OTPWallet.js
+219
-0
WalletDeposit.js
src/Screens/Action/Wallet/WalletDeposit.js
+6
-9
Upload.js
src/apis/Functions/Upload.js
+7
-0
users.js
src/apis/Functions/users.js
+1
-1
helpers.js
src/apis/helpers.js
+135
-135
url.js
src/apis/url.js
+2
-0
en.js
src/helper/i18/locales/en.js
+2
-0
vn.js
src/helper/i18/locales/vn.js
+2
-0
ScreenNames.js
src/routers/ScreenNames.js
+2
-0
StackNavigation.js
src/routers/StackNavigation.js
+2
-0
yarn.lock
yarn.lock
+5
-0
No files found.
package.json
View file @
4a87b671
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
"
@react-navigation/material-top-tabs
"
:
"^5.3.14"
,
"
@react-navigation/material-top-tabs
"
:
"^5.3.14"
,
"
@react-navigation/native
"
:
"^5.9.2"
,
"
@react-navigation/native
"
:
"^5.9.2"
,
"
@react-navigation/stack
"
:
"^5.14.2"
,
"
@react-navigation/stack
"
:
"^5.14.2"
,
"
async
"
:
"^3.2.0"
,
"
axios
"
:
"^0.21.1"
,
"
axios
"
:
"^0.21.1"
,
"
dateformat
"
:
"^4.5.1"
,
"
dateformat
"
:
"^4.5.1"
,
"
lodash
"
:
"^4.17.20"
,
"
lodash
"
:
"^4.17.20"
,
...
@@ -42,8 +43,8 @@
...
@@ -42,8 +43,8 @@
"
react-native-linear-gradient
"
:
"^2.5.6"
,
"
react-native-linear-gradient
"
:
"^2.5.6"
,
"
react-native-modal
"
:
"^11.7.0"
,
"
react-native-modal
"
:
"^11.7.0"
,
"
react-native-modal-dropdown
"
:
"^1.0.0"
,
"
react-native-modal-dropdown
"
:
"^1.0.0"
,
"
react-native-ratings
"
:
"^8.0.4"
,
"
react-native-progress
"
:
"^4.1.2"
,
"
react-native-progress
"
:
"^4.1.2"
,
"
react-native-ratings
"
:
"^8.0.4"
,
"
react-native-reanimated
"
:
"^1.13.2"
,
"
react-native-reanimated
"
:
"^1.13.2"
,
"
react-native-safe-area-context
"
:
"^3.1.9"
,
"
react-native-safe-area-context
"
:
"^3.1.9"
,
"
react-native-screens
"
:
"^2.17.1"
,
"
react-native-screens
"
:
"^2.17.1"
,
...
...
src/Screens/AccountVerification/Tab/Profile.js
View file @
4a87b671
...
@@ -29,6 +29,7 @@ import PickerDate from '../../../components/Picker/PickerDate';
...
@@ -29,6 +29,7 @@ import PickerDate from '../../../components/Picker/PickerDate';
import
PickerItem
from
'../../../components/Picker/PickerItem'
;
import
PickerItem
from
'../../../components/Picker/PickerItem'
;
import
{
saveUserToRedux
}
from
'../../../actions/users'
;
import
{
saveUserToRedux
}
from
'../../../actions/users'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
{
uploadImage
}
from
'../../../apis/Functions/Upload'
;
const
{
width
}
=
Dimensions
.
get
(
'window'
);
const
{
width
}
=
Dimensions
.
get
(
'window'
);
...
@@ -54,41 +55,23 @@ const Profile = (props) => {
...
@@ -54,41 +55,23 @@ const Profile = (props) => {
const
[
type
,
setType
]
=
useState
();
const
[
type
,
setType
]
=
useState
();
const
createFormData
=
(
identity_after
,
identity_before
,
sign_img
,
body
)
=>
{
const
createFormData
=
(
photo
,
body
)
=>
{
const
data
=
new
FormData
();
const
data
=
new
FormData
();
data
.
append
(
'image_file'
,
{
data
.
append
(
'identity_after'
,
{
name
:
'identity_after.jpg'
,
type
:
'image/jpg'
,
uri
:
Platform
.
OS
===
'android'
?
identity_after
:
identity_after
.
replace
(
'file://'
,
''
),
});
data
.
append
(
'identity_before'
,
{
name
:
'identity_before.jpg'
,
type
:
'image/jpg'
,
uri
:
Platform
.
OS
===
'android'
?
identity_before
:
identity_before
.
replace
(
'file://'
,
''
),
});
data
.
append
(
'sign_image'
,
{
name
:
'sign_img.jpg'
,
name
:
'sign_img.jpg'
,
type
:
'image/jpg'
,
type
:
'image/jpg'
,
uri
:
uri
:
Platform
.
OS
===
'android'
?
photo
:
photo
.
replace
(
'file://'
,
''
),
Platform
.
OS
===
'android'
?
sign_img
:
sign_img
.
replace
(
'file://'
,
''
),
});
});
Object
.
keys
(
body
).
forEach
((
key
)
=>
{
Object
.
keys
(
body
).
forEach
((
key
)
=>
{
data
.
append
(
key
,
body
[
key
]);
data
.
append
(
key
,
body
[
key
]);
});
});
console
.
log
(
'Data'
,
data
);
return
data
;
return
data
;
};
};
const
onPress
=
async
()
=>
{
const
onPress
=
async
()
=>
{
props
.
showLoading
();
var
async
=
require
(
'async'
);
const
titles
=
[
const
titles
=
[
I18n
.
t
(
'CardType'
).
toLowerCase
(),
I18n
.
t
(
'CardType'
).
toLowerCase
(),
I18n
.
t
(
'IdentityCardFrontPhoto'
),
I18n
.
t
(
'IdentityCardFrontPhoto'
),
...
@@ -97,33 +80,91 @@ const Profile = (props) => {
...
@@ -97,33 +80,91 @@ const Profile = (props) => {
];
];
const
index
=
checkFormatArray
([
type
,
urlBack
,
urlFont
,
urlSign
]);
const
index
=
checkFormatArray
([
type
,
urlBack
,
urlFont
,
urlSign
]);
if
(
index
===
true
)
{
if
(
index
===
true
)
{
const
data
=
createFormData
(
urlBack
,
urlFont
,
urlSign
,
{
async
.
parallel
(
card_type
:
type
.
value
,
[
uid
:
props
.
user
.
uid
,
async
function
(
callback
)
{
...
props
.
route
.
params
,
const
res
=
await
uploadImage
(
});
createFormData
(
urlFont
,
{
props
.
showLoading
();
scope
:
'VERIFY_USER'
,
const
res
=
await
verifyAccountApi
(
data
);
field_name
:
'identity_before'
,
props
.
hideLoading
();
platform
:
Platform
.
OS
,
console
.
log
(
res
);
}),
if
(
res
?.
status
==
200
&&
res
.
data
)
{
);
if
(
res
.
data
.
code
==
200
)
{
callback
(
null
,
res
);
setTimeout
(()
=>
{
},
props
.
saveUserToRedux
(
res
.
data
.
data
);
async
function
(
callback
)
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
const
res
=
await
uploadImage
(
props
.
navigation
.
popToTop
();
createFormData
(
urlBack
,
{
},
500
);
scope
:
'VERIFY_USER'
,
}
else
{
field_name
:
'identity_before'
,
setTimeout
(()
=>
{
platform
:
Platform
.
OS
,
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
}),
},
500
);
);
}
}
else
{
callback
(
null
,
res
);
setTimeout
(()
=>
{
},
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
'upload fail'
);
async
function
(
callback
)
{
},
500
);
const
res
=
await
uploadImage
(
}
createFormData
(
urlSign
,
{
scope
:
'VERIFY_USER'
,
field_name
:
'sign_img'
,
platform
:
Platform
.
OS
,
}),
);
callback
(
null
,
res
);
},
],
async
function
(
err
,
results
)
{
if
(
results
[
0
].
status
==
200
&&
results
[
1
].
status
==
200
&&
results
[
2
].
status
==
200
)
{
if
(
results
[
0
].
data
.
data
.
path
&&
results
[
1
].
data
.
data
.
path
&&
results
[
2
].
data
.
data
.
path
)
{
const
data
=
{
card_type
:
type
.
value
,
uid
:
props
.
user
.
uid
,
...
props
.
route
.
params
,
mode
:
'TEST'
,
identity_before_path
:
results
[
0
].
data
.
data
.
path
,
identity_after_path
:
results
[
1
].
data
.
data
.
path
,
sign_image_path
:
results
[
2
].
data
.
data
.
path
,
};
const
res
=
await
verifyAccountApi
(
data
);
props
.
hideLoading
();
if
(
res
?.
status
==
200
&&
res
.
data
)
{
if
(
res
.
data
.
code
==
200
)
{
setTimeout
(()
=>
{
props
.
saveUserToRedux
(
res
.
data
.
data
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
props
.
navigation
.
popToTop
();
},
500
);
}
else
{
props
.
hideLoading
();
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
}
}
else
{
props
.
hideLoading
();
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'UploadImageFail'
),
);
},
500
);
}
}
}
},
);
}
else
{
}
else
{
props
.
hideLoading
();
Alert
.
alert
(
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Please_fill_in'
)
+
titles
[
index
],
I18n
.
t
(
'Please_fill_in'
)
+
titles
[
index
],
...
...
src/Screens/Action/Wallet/OTPWallet.js
0 → 100644
View file @
4a87b671
import
React
,
{
Component
,
useEffect
,
useState
}
from
'react'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
TouchableOpacity
,
Platform
,
Alert
,
}
from
'react-native'
;
import
HeaderBack
from
'../../../components/Header/HeaderBack'
;
import
{
walletDeposit
}
from
'../../../apis/Functions/Deposit'
;
import
{
CodeField
,
Cursor
,
useBlurOnFulfill
,
useClearByFocusCell
,
}
from
'react-native-confirmation-code-field'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../../Config/Functions'
;
import
R
from
'.././../../assets/R'
;
import
{
verifyOTPApi
,
registorApi
}
from
'../../../apis/Functions/users'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
AppText
from
'../../../components/AppText'
;
import
{
showLoading
,
hideLoading
}
from
'../../../actions/loadingAction'
;
import
{
connect
}
from
'react-redux'
;
import
{
TABNAVIGATOR
}
from
'../../../routers/ScreenNames'
;
const
CELL_COUNT
=
4
;
const
ConfirmOTP
=
(
propsa
)
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
navigate
=
useNavigation
();
const
ref
=
useBlurOnFulfill
({
value
,
cellCount
:
CELL_COUNT
});
const
[
props
,
getCellOnLayoutHandler
]
=
useClearByFocusCell
({
value
,
setValue
,
});
const
confirm
=
async
()
=>
{
if
(
!
value
)
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'EnterOTPRequest'
));
}
else
if
(
value
.
length
!=
4
)
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'OTPInvalid'
));
}
else
{
propsa
.
showLoading
();
const
res
=
await
verifyOTPApi
({
platform
:
Platform
.
OS
,
receiver_name
:
propsa
.
user
.
email
,
otp
:
value
,
});
if
(
res
.
data
.
code
==
200
)
{
const
{
amount
,
notes
,
type
}
=
propsa
.
route
.
params
;
const
res
=
await
walletDeposit
({
amount
,
platform
:
Platform
.
OS
,
notes
,
fee
:
0
,
});
propsa
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
navigate
.
navigate
(
TABNAVIGATOR
);
},
500
);
}
else
{
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
}
}
else
{
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
}
propsa
.
hideLoading
();
}
};
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'VerifyOTP'
}
/
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{{
height
:
20
}}
/
>
<
View
style
=
{
styles
.
wrap
}
>
<
AppText
i18nKey
=
{
'Verify_code'
}
style
=
{
styles
.
txtTitle
}
/
>
<
View
style
=
{
styles
.
containerCode
}
>
<
CodeField
ref
=
{
ref
}
{...
props
}
value
=
{
value
}
onChangeText
=
{
setValue
}
cellCount
=
{
CELL_COUNT
}
rootStyle
=
{
styles
.
codeFieldRoot
}
keyboardType
=
"number-pad"
textContentType
=
"oneTimeCode"
renderCell
=
{({
index
,
symbol
,
isFocused
})
=>
(
<
View
onLayout
=
{
getCellOnLayoutHandler
(
index
)}
key
=
{
index
}
style
=
{[
styles
.
cellRoot
,
isFocused
&&
styles
.
focusCell
]}
>
<
Text
style
=
{
styles
.
cellText
}
>
{
symbol
||
(
isFocused
?
<
Cursor
/>
:
null
)}
<
/Text
>
<
/View
>
)}
/
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
footer
}
>
<
TouchableOpacity
onPress
=
{
confirm
}
style
=
{
styles
.
btn
}
>
<
AppText
i18nKey
=
{
'Continue'
}
style
=
{
styles
.
txtBtn
}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
wrapFooter
}
onPress
=
{()
=>
navigate
.
goBack
()}
>
<
Text
style
=
{
styles
.
txtNote
}
>
{
I18n
.
t
(
'OTPValidFiveMinute'
)}
<
/Text
>
<
AppText
i18nKey
=
{
'Re_send'
}
style
=
{
styles
.
txtSend
}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
};
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
paddingVertical
:
20
,
},
footer
:
{
height
:
200
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
wrap
:
{
flex
:
1
,
paddingTop
:
30
,
alignItems
:
'center'
,
width
:
'100%'
,
paddingHorizontal
:
50
,
},
containerCode
:
{
height
:
50
,
width
:
'100%'
,
marginTop
:
30
,
},
codeFieldRoot
:
{
marginTop
:
20
,
},
focusCell
:
{
borderColor
:
'#000'
,
},
cellRoot
:
{
width
:
40
,
height
:
40
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
borderBottomColor
:
'#ccc'
,
borderBottomWidth
:
1
,
},
cellText
:
{
color
:
'#000'
,
fontSize
:
36
,
textAlign
:
'center'
,
},
focusCell
:
{
borderBottomColor
:
'#007AFF'
,
borderBottomWidth
:
2
,
},
txtTitle
:
{
fontSize
:
getFontXD
(
52
),
color
:
'#979797'
,
},
btn
:
{
width
:
WIDTHXD
(
521
),
height
:
HEIGHTXD
(
120
),
borderRadius
:
15
,
backgroundColor
:
'#1C6AF6'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
txtBtn
:
{
color
:
R
.
colors
.
white
,
fontSize
:
getFontXD
(
52
),
textTransform
:
'uppercase'
,
},
txtSend
:
{
fontSize
:
getFontXD
(
42
),
color
:
'#1C6AF6'
,
},
wrapFooter
:
{
marginTop
:
30
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
},
txtNote
:
{
color
:
'#A2A2A2'
,
fontSize
:
getFontXD
(
42
),
fontStyle
:
'italic'
,
},
});
const
mapStateToProps
=
(
state
)
=>
{
return
{
user
:
state
.
userReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
ConfirmOTP
);
src/Screens/Action/Wallet/WalletDeposit.js
View file @
4a87b671
...
@@ -28,6 +28,9 @@ import {showLoading, hideLoading} from '../../../actions/loadingAction';
...
@@ -28,6 +28,9 @@ import {showLoading, hideLoading} from '../../../actions/loadingAction';
import
{
walletDeposit
}
from
'../../../apis/Functions/Deposit'
;
import
{
walletDeposit
}
from
'../../../apis/Functions/Deposit'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
{
OTPWALLET
}
from
'../../../routers/ScreenNames'
;
import
{
getOTPApi
}
from
'../../../apis/Functions/users'
;
const
{
width
}
=
Dimensions
.
get
(
'window'
);
const
{
width
}
=
Dimensions
.
get
(
'window'
);
...
@@ -45,19 +48,13 @@ const WalletDeposit = (props) => {
...
@@ -45,19 +48,13 @@ const WalletDeposit = (props) => {
const
index
=
checkFormatArray
([
amount
,
notes
]);
const
index
=
checkFormatArray
([
amount
,
notes
]);
if
(
index
===
true
)
{
if
(
index
===
true
)
{
props
.
showLoading
();
props
.
showLoading
();
const
res
=
await
walletDeposit
({
const
res
=
await
getOTPApi
({
amount
,
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
notes
,
otp_by
:
props
.
user
.
email
,
fee
:
0
,
});
});
props
.
hideLoading
();
props
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
setTimeout
(()
=>
{
navigate
.
navigate
(
OTPWALLET
,
{
type
:
'DEPOSIT'
,
amount
,
notes
});
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
navigate
.
goBack
();
},
500
);
}
else
{
}
else
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
...
...
src/apis/Functions/Upload.js
0 → 100644
View file @
4a87b671
import
{
PostLogin
,
GetData
,
PostFormData
}
from
'../helpers'
;
import
url
from
'../url'
;
export
const
uploadImage
=
async
(
body
)
=>
PostFormData
(
url
.
urlUploadImage
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
src/apis/Functions/users.js
View file @
4a87b671
...
@@ -33,7 +33,7 @@ export const forgotPasswordApi = async (body) =>
...
@@ -33,7 +33,7 @@ export const forgotPasswordApi = async (body) =>
.
catch
((
err
)
=>
err
);
.
catch
((
err
)
=>
err
);
export
const
verifyAccountApi
=
async
(
body
)
=>
export
const
verifyAccountApi
=
async
(
body
)
=>
Post
Form
Data
(
url
.
urlVerifyAccount
,
body
)
PostData
(
url
.
urlVerifyAccount
,
body
)
.
then
((
res
)
=>
res
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
.
catch
((
err
)
=>
err
);
...
...
src/apis/helpers.js
View file @
4a87b671
...
@@ -5,127 +5,127 @@ import AsyncStorage from '@react-native-community/async-storage';
...
@@ -5,127 +5,127 @@ import AsyncStorage from '@react-native-community/async-storage';
axios
.
defaults
.
timeout
=
10000
;
axios
.
defaults
.
timeout
=
10000
;
export
async
function
GetData
(
url
,
data
)
{
export
async
function
GetData
(
url
,
data
)
{
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
let
myRequest
=
{
let
myRequest
=
{
method
:
'get'
,
method
:
'get'
,
url
,
url
,
headers
:
{
headers
:
{
Accept
:
'application/json'
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
Authorization
:
'Bearer '
+
token
,
Authorization
:
'Bearer '
+
token
,
},
},
params
:
{
params
:
{
...
data
,
...
data
,
},
},
timeout
:
30
*
1000
,
timeout
:
30
*
1000
,
// withCredentials: true,
// withCredentials: true,
};
};
console
.
log
(
'My request'
,
myRequest
);
console
.
log
(
'My request'
,
myRequest
);
return
await
axios
(
myRequest
)
return
await
axios
(
myRequest
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
console
.
log
(
error
.
request
);
console
.
log
(
error
.
request
);
const
err
=
{
const
err
=
{
message
:
'error'
,
message
:
'error'
,
status
:
error
.
request
.
status
,
status
:
error
.
request
.
status
,
};
};
return
err
;
return
err
;
});
});
}
}
export
async
function
PostLogin
(
url
,
json
)
{
export
async
function
PostLogin
(
url
,
json
)
{
let
myRequest
=
{
let
myRequest
=
{
method
:
'post'
,
method
:
'post'
,
url
,
url
,
headers
:
{
headers
:
{
Accept
:
'application/json'
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
},
},
timeout
:
30
*
1000
,
timeout
:
30
*
1000
,
data
:
JSON
.
stringify
(
json
),
data
:
JSON
.
stringify
(
json
),
};
};
console
.
log
(
'post data mobile'
,
myRequest
);
console
.
log
(
'post data mobile'
,
myRequest
);
return
await
axios
(
myRequest
)
return
await
axios
(
myRequest
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
const
err
=
{
const
err
=
{
message
:
'error'
,
message
:
'error'
,
status
:
error
.
request
.
status
,
status
:
error
.
request
.
status
,
};
};
return
err
;
return
err
;
});
});
}
}
export
async
function
PostData
(
url
,
json
,
isAuth
=
true
)
{
export
async
function
PostData
(
url
,
json
,
isAuth
=
true
)
{
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
console
.
log
(
token
);
console
.
log
(
token
);
let
myRequest
=
{
let
myRequest
=
{
method
:
'post'
,
method
:
'post'
,
url
,
url
,
headers
:
{
headers
:
{
Accept
:
'application/json'
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
Authorization
:
'Bearer '
+
token
,
Authorization
:
'Bearer '
+
token
,
},
},
timeout
:
30
*
1000
,
timeout
:
30
*
1000
,
data
:
JSON
.
stringify
(
json
),
data
:
JSON
.
stringify
(
json
),
};
};
console
.
log
(
'post data mobile'
,
myRequest
);
console
.
log
(
'post data mobile'
,
myRequest
);
return
await
axios
(
myRequest
)
return
await
axios
(
myRequest
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
console
.
log
(
error
.
request
);
console
.
log
(
error
.
request
);
const
err
=
{
const
err
=
{
message
:
'error'
,
message
:
'error'
,
status
:
error
.
request
.
status
,
status
:
error
.
request
.
status
,
};
};
return
err
;
return
err
;
});
});
}
}
export
async
function
PostFormData
(
url
,
data
)
{
export
async
function
PostFormData
(
url
,
data
)
{
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
const
source
=
axios
.
CancelToken
.
source
();
const
source
=
axios
.
CancelToken
.
source
();
const
timeout
=
setTimeout
(()
=>
{
const
timeout
=
setTimeout
(()
=>
{
source
.
cancel
();
source
.
cancel
();
// Timeout Logic
// Timeout Logic
},
1
000
);
},
60
000
);
console
.
log
(
token
);
console
.
log
(
token
);
let
myRequest
=
{
let
myRequest
=
{
method
:
'post'
,
method
:
'post'
,
url
,
url
,
headers
:
{
headers
:
{
Accept
:
'application/json'
,
Accept
:
'application/json'
,
'Content-Type'
:
'multipart/form-data'
,
'Content-Type'
:
'multipart/form-data'
,
Authorization
:
'Bearer '
+
token
,
Authorization
:
'Bearer '
+
token
,
},
},
timeout
:
1
000
,
timeout
:
60
000
,
data
:
data
,
data
:
data
,
cancelToken
:
source
.
token
,
cancelToken
:
source
.
token
,
};
};
console
.
log
(
'post data mobile'
,
myRequest
.
data
);
console
.
log
(
'post data mobile'
,
myRequest
.
data
);
return
await
axios
(
myRequest
)
return
await
axios
(
myRequest
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
clearTimeout
(
timeout
);
clearTimeout
(
timeout
);
return
response
;
return
response
;
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
clearTimeout
(
timeout
);
clearTimeout
(
timeout
);
return
response
;
return
response
;
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
clearTimeout
(
timeout
);
clearTimeout
(
timeout
);
console
.
log
(
'errorTimeout'
,
error
);
console
.
log
(
'errorTimeout'
,
error
);
const
err
=
{
const
err
=
{
message
:
'error'
,
message
:
'error'
,
status
:
error
.
request
.
status
,
status
:
error
.
request
.
status
,
};
};
return
err
;
return
err
;
});
});
}
}
/**
/**
...
@@ -135,27 +135,27 @@ export async function PostFormData(url, data) {
...
@@ -135,27 +135,27 @@ export async function PostFormData(url, data) {
* @param {*} isAuth is state auth
* @param {*} isAuth is state auth
*/
*/
export
async
function
PutData
(
url
,
json
,
isAuth
=
true
)
{
export
async
function
PutData
(
url
,
json
,
isAuth
=
true
)
{
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
const
token
=
await
AsyncStorage
.
getItem
(
KEY
.
TOKEN
);
let
myRequest
=
{
let
myRequest
=
{
method
:
'put'
,
method
:
'put'
,
url
,
url
,
headers
:
{
headers
:
{
Accept
:
'application/json'
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
Authorization
:
'Bearer '
+
token
,
Authorization
:
'Bearer '
+
token
,
},
},
data
:
JSON
.
stringify
(
json
),
data
:
JSON
.
stringify
(
json
),
};
};
console
.
log
(
'PutData'
,
myRequest
);
console
.
log
(
'PutData'
,
myRequest
);
return
await
axios
(
myRequest
)
return
await
axios
(
myRequest
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
then
((
response
)
=>
response
)
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
console
.
log
(
error
.
request
);
console
.
log
(
error
.
request
);
const
err
=
{
const
err
=
{
message
:
'error'
,
message
:
'error'
,
status
:
error
.
request
.
status
,
status
:
error
.
request
.
status
,
};
};
return
err
;
return
err
;
});
});
}
}
src/apis/url.js
View file @
4a87b671
...
@@ -48,4 +48,6 @@ export default {
...
@@ -48,4 +48,6 @@ export default {
urlGetContractDescription
:
`
${
root
}
api/v1/transactions/products/specification-contract/`
,
urlGetContractDescription
:
`
${
root
}
api/v1/transactions/products/specification-contract/`
,
urlChangeAvatar
:
root
+
'api/v1/customers/update-avatar'
,
urlChangeAvatar
:
root
+
'api/v1/customers/update-avatar'
,
urlUploadImage
:
root
+
'api/v1/uploads/upload-image'
,
};
};
src/helper/i18/locales/en.js
View file @
4a87b671
...
@@ -229,4 +229,6 @@ export default {
...
@@ -229,4 +229,6 @@ export default {
FeedBackDCV
:
'Feedback for DCV Invest'
,
FeedBackDCV
:
'Feedback for DCV Invest'
,
ReVerify
:
'Re-Verify'
,
ReVerify
:
'Re-Verify'
,
RejectVerify
:
'Reject verify'
,
RejectVerify
:
'Reject verify'
,
UploadImageFail
:
'The network connection is not stable, please check the connection'
,
};
};
src/helper/i18/locales/vn.js
View file @
4a87b671
...
@@ -231,4 +231,6 @@ export default {
...
@@ -231,4 +231,6 @@ export default {
FeedBackDCV
:
'Đánh giá dịch vụ của DCV Invest'
,
FeedBackDCV
:
'Đánh giá dịch vụ của DCV Invest'
,
ReVerify
:
'Xác minh lại'
,
ReVerify
:
'Xác minh lại'
,
RejectVerify
:
'Từ chối xác minh'
,
RejectVerify
:
'Từ chối xác minh'
,
UploadImageFail
:
'Đường truyền mạng không ổn định.Xin kiểm tra lại đường truyền!'
,
};
};
src/routers/ScreenNames.js
View file @
4a87b671
...
@@ -67,3 +67,5 @@ export const LEGALPARTNER = 'LEGALPARTNER';
...
@@ -67,3 +67,5 @@ export const LEGALPARTNER = 'LEGALPARTNER';
export
const
HISTORYDETAIL
=
'HISTORYDETAIL'
;
export
const
HISTORYDETAIL
=
'HISTORYDETAIL'
;
export
const
PRODUCTDETAIL
=
'PRODUCTDETAIL'
;
export
const
PRODUCTDETAIL
=
'PRODUCTDETAIL'
;
export
const
REGISTEROTP
=
'REGISTEROTP'
;
export
const
REGISTEROTP
=
'REGISTEROTP'
;
export
const
OTPWALLET
=
'OTPWALLET'
;
src/routers/StackNavigation.js
View file @
4a87b671
...
@@ -47,6 +47,7 @@ import SnackBar from '../components/SnackBar';
...
@@ -47,6 +47,7 @@ import SnackBar from '../components/SnackBar';
import
DetailHistory
from
'../Screens/Action/History/DetailHistory'
;
import
DetailHistory
from
'../Screens/Action/History/DetailHistory'
;
import
ProductDetail
from
'../Screens/Transaction/ProductDetail/ProductDetail'
;
import
ProductDetail
from
'../Screens/Transaction/ProductDetail/ProductDetail'
;
import
RegisterOTP
from
'../Screens/Authen/RegisterOTP'
;
import
RegisterOTP
from
'../Screens/Authen/RegisterOTP'
;
import
OTPWallet
from
'../Screens/Action/Wallet/OTPWallet'
;
import
*
as
ScreenName
from
'./ScreenNames'
;
import
*
as
ScreenName
from
'./ScreenNames'
;
...
@@ -65,6 +66,7 @@ function MyStack(props) {
...
@@ -65,6 +66,7 @@ function MyStack(props) {
headerMode
=
{
'none'
}
headerMode
=
{
'none'
}
initialRouteName
=
{
ScreenName
.
AUTHEN
}
>
initialRouteName
=
{
ScreenName
.
AUTHEN
}
>
<
Stack
.
Screen
name
=
{
ScreenName
.
LOGINSCREEN
}
component
=
{
Login
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
LOGINSCREEN
}
component
=
{
Login
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
OTPWALLET
}
component
=
{
OTPWallet
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
HISTORYDETAIL
}
component
=
{
DetailHistory
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
HISTORYDETAIL
}
component
=
{
DetailHistory
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
LEGALDOCUMENT
}
component
=
{
LegaDocument
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
LEGALDOCUMENT
}
component
=
{
LegaDocument
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
NOTIFICATION
}
component
=
{
Notification
}
/
>
<
Stack
.
Screen
name
=
{
ScreenName
.
NOTIFICATION
}
component
=
{
Notification
}
/
>
...
...
yarn.lock
View file @
4a87b671
...
@@ -2145,6 +2145,11 @@ async@^2.4.0:
...
@@ -2145,6 +2145,11 @@ async@^2.4.0:
dependencies:
dependencies:
lodash "^4.17.14"
lodash "^4.17.14"
async@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720"
integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==
asynckit@^0.4.0:
asynckit@^0.4.0:
version "0.4.0"
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment