Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
new_excelso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Prasetya Saputra
new_excelso
Commits
c4940e3f
Commit
c4940e3f
authored
Jul 03, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nambahin try cath untuk menangkap error di hp pak benny
parent
0c07d48d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
579 additions
and
484 deletions
+579
-484
Account.js
view/Account.js
+434
-374
NewsDetail.js
view/NewsDetail.js
+55
-40
RewardsList.js
view/RewardsList.js
+90
-70
No files found.
view/Account.js
View file @
c4940e3f
...
...
@@ -51,12 +51,14 @@ class Account extends React.Component {
old_balance_claimed
:
false
,
old_balance
:
0
,
is_expired
:
false
,
card_number
:
""
,
card_number
:
""
,
}
}
componentDidMount
()
{
try
{
this
.
_getProfile
()
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
this
.
setState
({
...
...
@@ -64,13 +66,23 @@ class Account extends React.Component {
})
this
.
_getProfile
()
});
}
catch
(
error
)
{
Alert
.
alert
(
'Error'
+
error
)
}
}
componentWillUnmount
()
{
try
{
this
.
_unsubscribe
();
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
)
}
}
_getPermissions
=
async
()
=>
{
try
{
let
{
status
}
=
await
Permissions
.
askAsync
(
Permissions
.
LOCATION
);
if
(
status
!==
'granted'
)
{
Alert
.
alert
(
'Akses tidak dizinkan!'
)
...
...
@@ -80,8 +92,13 @@ class Account extends React.Component {
}
else
{
this
.
_getCurrentPosisition
()
}
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
)
}
}
_getCurrentPosisition
=
async
()
=>
{
try
{
this
.
setState
({
spinner
:
true
,
})
...
...
@@ -98,18 +115,28 @@ class Account extends React.Component {
})
this
.
_getProfile
()
}
catch
(
error
)
{
Alert
.
alert
(
'Error: + '
,
error
)
}
}
logout
()
{
try
{
let
configProps
=
{
session_id
:
''
}
this
.
props
.
setConfig
(
configProps
);
this
.
props
.
navigation
.
replace
(
'Login'
);
}
catch
(
error
)
{
Alert
.
alert
(
'ERROR : '
+
error
)
}
}
onClickClaimCredit
()
{
try
{
Alert
.
alert
(
""
,
"Are you sure want to claim credit ?"
,
...
...
@@ -125,10 +152,16 @@ class Account extends React.Component {
],
{
cancelable
:
false
},
)
}
catch
(
error
)
{
Alert
.
alert
(
'Error: '
+
error
)
}
}
handleClaimCredit
()
{
let
params
=
Object
.
assign
(
requestParams
,{
try
{
let
params
=
Object
.
assign
(
requestParams
,
{
session_id
:
this
.
props
.
session_id
,
})
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/card/claim_old_balance'
,
params
).
then
(
res
=>
{
...
...
@@ -137,10 +170,16 @@ class Account extends React.Component {
let
response
=
error
.
response
.
data
Alert
.
alert
(
error
,
response
.
msg
)
})
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
)
}
}
_getProfile
()
{
let
params
=
Object
.
assign
(
requestParams
,{
try
{
let
params
=
Object
.
assign
(
requestParams
,
{
session_id
:
this
.
props
.
session_id
,
lat
:
this
.
state
.
my_lat
,
long
:
this
.
state
.
my_long
,
...
...
@@ -148,7 +187,7 @@ class Account extends React.Component {
})
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/member/get_profile'
,
params
).
then
(
res
=>
{
console
.
log
(
"INI DATANYA : "
+
JSON
.
stringify
(
res
))
console
.
log
(
"INI DATANYA : "
+
JSON
.
stringify
(
res
))
const
dataCard
=
res
.
data
console
.
log
(
dataCard
)
let
email
=
dataCard
.
email
...
...
@@ -213,10 +252,16 @@ class Account extends React.Component {
// Alert.alert('',response.msg);
Toast
.
show
(
response
.
msg
)
})
}
catch
(
error
)
{
Alert
.
alert
(
'Error :'
+
error
)
}
}
TransferBalance
()
{
try
{
if
(
this
.
state
.
premium
===
false
)
{
Alert
.
alert
(
'Akun Belum Premium'
,
...
...
@@ -229,10 +274,16 @@ class Account extends React.Component {
}
else
{
this
.
props
.
navigation
.
navigate
(
'Transfer Balance'
);
}
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
)
}
}
handleuseBalance
()
{
let
params
=
Object
.
assign
(
requestParams
,{
try
{
let
params
=
Object
.
assign
(
requestParams
,
{
session_id
:
this
.
props
.
session_id
,
})
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/point/check'
,
params
).
then
(
res
=>
{
...
...
@@ -245,13 +296,18 @@ class Account extends React.Component {
let
response
=
error
.
response
.
data
Alert
.
alert
(
error
,
response
.
msg
)
})
}
catch
(
error
)
{
Alert
.
alert
(
'Error:'
+
error
)
}
}
render
()
{
try
{
const
navigation
=
this
.
props
.
navigation
return
(
<
View
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{{
paddingTop
:
StatusBar
.
currentHeight
}}
>
<
ScrollView
style
=
{{
paddingTop
:
StatusBar
.
currentHeight
}}
>
<
View
style
=
{{
flex
:
1
,
height
:
90
}}
>
<
View
style
=
{{
alignSelf
:
'center'
}}
>
...
...
@@ -360,7 +416,7 @@ class Account extends React.Component {
{
this
.
state
.
is_expired
?
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Renewal'
)}
>
<
View
style
=
{{
height
:
40
,
borderRadius
:
10
,
backgroundColor
:
'#CFB368'
,
marginRight
:
20
,
marginLeft
:
20
,
marginTop
:
20
,
justifyContent
:
'center'
}}
>
<
View
style
=
{{
height
:
40
,
borderRadius
:
10
,
backgroundColor
:
'#CFB368'
,
marginRight
:
20
,
marginLeft
:
20
,
marginTop
:
20
,
justifyContent
:
'center'
}}
>
<
Text
style
=
{{
fontFamily
:
'Gotham-Black'
,
color
:
'white'
,
fontSize
:
16
,
textAlign
:
'center'
,
margin
:
15
}}
>
RENEWAL
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
...
...
@@ -371,7 +427,7 @@ class Account extends React.Component {
<
Card
style
=
{{
padding
:
10
,
margin
:
10
,
alignContent
:
'center'
}}
>
<
View
style
=
{{
flex
:
1
,
height
:
80
,
borderRadius
:
20
,
marginRight
:
10
,
marginLeft
:
10
,
justifyContent
:
'center'
}}
>
{
/* <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10 }}>CREDIT : {this.state.old_balance} </Text> */
}
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
state
.
old_balance
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
14
,
fontFamily
:
'Gotham-Light'
,
textAlign
:
'center'
,
marginBottom
:
10
,
color
:
'#838383'
}}
>
CREDIT
:
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
state
.
old_balance
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
14
,
fontFamily
:
'Gotham-Light'
,
textAlign
:
'center'
,
marginBottom
:
10
,
color
:
'#838383'
}}
>
CREDIT
:
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
View
style
=
{{
justifyContent
:
'center'
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
onClickClaimCredit
()}
>
<
View
style
=
{{
height
:
40
,
borderRadius
:
10
,
backgroundColor
:
'#CFB368'
,
marginRight
:
20
,
marginLeft
:
20
,
justifyContent
:
'center'
}}
>
...
...
@@ -489,6 +545,10 @@ class Account extends React.Component {
<
/View
>
)
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
)
}
}
}
...
...
view/NewsDetail.js
View file @
c4940e3f
import
React
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
Dimensions
}
from
'react-native'
;
import
{
View
,
Text
,
StyleSheet
,
Dimensions
,
Alert
}
from
'react-native'
;
import
{
Image
}
from
'react-native-elements'
;
import
Axios
from
'axios'
;
import
{
TouchableOpacity
,
ScrollView
}
from
'react-native-gesture-handler'
;
...
...
@@ -20,6 +20,7 @@ export default class NewsDetail extends React.Component {
}
componentDidMount
()
{
try
{
const
screenWidth
=
Math
.
round
(
Dimensions
.
get
(
'window'
).
width
);
const
statusBarHeight
=
getStatusBarHeight
();
this
.
setState
({
...
...
@@ -27,9 +28,14 @@ export default class NewsDetail extends React.Component {
statusbar_height
:
statusBarHeight
})
this
.
get_news_detail
(
this
.
props
.
route
.
params
.
slug
)
}
catch
(
error
)
{
Alert
.
alert
(
'Error'
,
+
error
)
}
}
get_news_detail
(
slug
)
{
try
{
Axios
.
get
(
'https://excelsocrm.ravintoladev.com/cms/v2/detail/'
+
slug
).
then
(
res
=>
{
const
detail
=
res
.
data
;
this
.
setState
({
...
...
@@ -39,11 +45,16 @@ export default class NewsDetail extends React.Component {
content
:
detail
.
content
,
})
})
}
catch
(
error
)
{
Alert
.
alert
(
'Error:'
+
error
)
}
}
render
()
{
// console.log(this.state.content)
try
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
MyStatusBar
/>
...
...
@@ -67,6 +78,10 @@ export default class NewsDetail extends React.Component {
<
/ScrollView
>
<
/View
>
)
}
catch
(
error
)
{
Alert
.
alert
(
'Error'
+
error
)
}
}
}
...
...
view/RewardsList.js
View file @
c4940e3f
...
...
@@ -18,6 +18,8 @@ class RewardsList extends React.Component {
componentDidMount
()
{
// console.log("INI YA REWARD URL :"+this.props.BASE_URL)
try
{
this
.
getRewardsList
()
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
this
.
setState
({
...
...
@@ -26,13 +28,23 @@ class RewardsList extends React.Component {
this
.
getRewardsList
()
});
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
,
+
error
)
}
}
componentWillUnmount
()
{
try
{
this
.
_unsubscribe
()
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
);
}
}
getRewardsList
()
{
try
{
let
params
=
Object
.
assign
(
requestParams
,{
session_id
:
this
.
props
.
session_id
,
})
...
...
@@ -53,9 +65,14 @@ class RewardsList extends React.Component {
let
response
=
error
.
response
.
data
;
Alert
.
alert
(
response
.
status
,
response
.
msg
);
})
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
);
}
}
render
()
{
try
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
StatusBar
backgroundColor
=
'#CFB368'
/>
...
...
@@ -103,6 +120,9 @@ class RewardsList extends React.Component {
<
/ScrollView
>
<
/View
>
)
}
catch
(
error
)
{
Alert
.
alert
(
'ERROR :'
+
error
)
}
}
}
...
...
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