Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
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
Dida Adams Arizona
Tia-dev
Commits
72957447
Commit
72957447
authored
Sep 01, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'syadziy' into 'master'
Syadziy See merge request
!216
parents
375bc669
652fb493
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
356 additions
and
219 deletions
+356
-219
CreatePerusahaan.js
src/container/MasterData/Perusahaan/CreatePerusahaan.js
+84
-50
Perusahaan.js
src/container/MasterData/Perusahaan/Perusahaan.js
+236
-163
VisualPerusahaan.js
src/container/MasterData/Perusahaan/VisualPerusahaan.js
+36
-6
No files found.
src/container/MasterData/Perusahaan/CreatePerusahaan.js
View file @
72957447
...
@@ -7,6 +7,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
...
@@ -7,6 +7,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
api
from
'../../../api'
;
import
api
from
'../../../api'
;
import
Images
from
'../../../assets/Images'
;
import
Images
from
'../../../assets/Images'
;
import
Constant
from
'../../../library/Constant'
;
const
Alert
=
withStyles
({
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
@@ -71,6 +72,7 @@ export default class CreatePerusahaan extends Component {
...
@@ -71,6 +72,7 @@ export default class CreatePerusahaan extends Component {
api
.
create
().
getDetailPerusahaan
(
this
.
props
.
data
[
1
]).
then
(
response
=>
{
api
.
create
().
getDetailPerusahaan
(
this
.
props
.
data
[
1
]).
then
(
response
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
this
.
setState
({
businessID
:
response
.
data
.
data
.
business_unit_id
,
businessID
:
response
.
data
.
data
.
business_unit_id
,
...
@@ -86,7 +88,17 @@ export default class CreatePerusahaan extends Component {
...
@@ -86,7 +88,17 @@ export default class CreatePerusahaan extends Component {
updated
:
response
.
data
.
data
.
updated
===
null
?
""
:
response
.
data
.
data
.
updated
updated
:
response
.
data
.
data
.
updated
===
null
?
""
:
response
.
data
.
data
.
updated
},
()
=>
this
.
getAllUnitBisnis
(),
this
.
getCompanyActive
())
},
()
=>
this
.
getAllUnitBisnis
(),
this
.
getCompanyActive
())
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -103,6 +115,7 @@ export default class CreatePerusahaan extends Component {
...
@@ -103,6 +115,7 @@ export default class CreatePerusahaan extends Component {
api
.
create
().
getPerusahaanActive
(
payload
).
then
(
response
=>
{
api
.
create
().
getPerusahaanActive
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
perusahaanData
=
data
.
map
((
item
)
=>
{
let
perusahaanData
=
data
.
map
((
item
)
=>
{
...
@@ -118,7 +131,17 @@ export default class CreatePerusahaan extends Component {
...
@@ -118,7 +131,17 @@ export default class CreatePerusahaan extends Component {
};
};
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
,
getPerusahaan
:
index
==
-
1
?
null
:
perusahaanData
[
index
]
})
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
,
getPerusahaan
:
index
==
-
1
?
null
:
perusahaanData
[
index
]
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -130,6 +153,7 @@ export default class CreatePerusahaan extends Component {
...
@@ -130,6 +153,7 @@ export default class CreatePerusahaan extends Component {
getAllUnitBisnis
()
{
getAllUnitBisnis
()
{
api
.
create
().
getUnitBisnisActive
().
then
(
response
=>
{
api
.
create
().
getUnitBisnisActive
().
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
typeData
=
data
.
map
((
item
)
=>
{
let
typeData
=
data
.
map
((
item
)
=>
{
...
@@ -147,7 +171,17 @@ export default class CreatePerusahaan extends Component {
...
@@ -147,7 +171,17 @@ export default class CreatePerusahaan extends Component {
};
};
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
null
:
typeData
[
index
]
})
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
null
:
typeData
[
index
]
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
...
src/container/MasterData/Perusahaan/Perusahaan.js
View file @
72957447
...
@@ -15,6 +15,7 @@ import ReactTooltip from 'react-tooltip';
...
@@ -15,6 +15,7 @@ import ReactTooltip from 'react-tooltip';
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
{
TextField
,
InputBase
,
Snackbar
,
withStyles
}
from
"@material-ui/core"
;
import
{
TextField
,
InputBase
,
Snackbar
,
withStyles
}
from
"@material-ui/core"
;
import
PopUpFailedSave
from
'../../../library/PopUpFailedSave'
;
import
PopUpFailedSave
from
'../../../library/PopUpFailedSave'
;
import
Constant
from
'../../../library/Constant'
;
var
ct
=
require
(
"../../../library/CustomTable"
);
var
ct
=
require
(
"../../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
@@ -78,6 +79,8 @@ export default class Perusahaan extends Component {
...
@@ -78,6 +79,8 @@ export default class Perusahaan extends Component {
this
.
setState
({
payload
:
body
,
buttonError
:
false
})
this
.
setState
({
payload
:
body
,
buttonError
:
false
})
api
.
create
().
checkUploadPerusahaan
(
body
).
then
(
response
=>
{
api
.
create
().
checkUploadPerusahaan
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
return
[
...
@@ -231,6 +234,21 @@ export default class Perusahaan extends Component {
...
@@ -231,6 +234,21 @@ export default class Perusahaan extends Component {
cols
:
columns
,
cols
:
columns
,
rows
:
dataRow
rows
:
dataRow
});
});
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
console
.
log
(
response
);
console
.
log
(
response
);
})
})
...
@@ -270,6 +288,7 @@ export default class Perusahaan extends Component {
...
@@ -270,6 +288,7 @@ export default class Perusahaan extends Component {
api
.
create
().
getPerusahaan
().
then
((
response
)
=>
{
api
.
create
().
getPerusahaan
().
then
((
response
)
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
map
((
item
,
index
)
=>
{
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
map
((
item
,
index
)
=>
{
...
@@ -277,7 +296,17 @@ export default class Perusahaan extends Component {
...
@@ -277,7 +296,17 @@ export default class Perusahaan extends Component {
})
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
dataTable
:
[]
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
dataTable
:
[]
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
dataTable
:
[]
})
...
@@ -306,6 +335,7 @@ export default class Perusahaan extends Component {
...
@@ -306,6 +335,7 @@ export default class Perusahaan extends Component {
}
}
api
.
create
().
searchPerusahaan
(
body
).
then
(
response
=>
{
api
.
create
().
searchPerusahaan
(
body
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
let
listData
=
data
.
map
((
item
,
index
)
=>
{
...
@@ -313,7 +343,17 @@ export default class Perusahaan extends Component {
...
@@ -313,7 +343,17 @@ export default class Perusahaan extends Component {
})
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -325,11 +365,22 @@ export default class Perusahaan extends Component {
...
@@ -325,11 +365,22 @@ export default class Perusahaan extends Component {
this
.
setState
({
visibleEdit
:
false
})
this
.
setState
({
visibleEdit
:
false
})
api
.
create
().
updatePerusahaan
(
payload
).
then
(
response
=>
{
api
.
create
().
updatePerusahaan
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -341,11 +392,22 @@ export default class Perusahaan extends Component {
...
@@ -341,11 +392,22 @@ export default class Perusahaan extends Component {
this
.
setState
({
visibleCreate
:
false
})
this
.
setState
({
visibleCreate
:
false
})
api
.
create
().
createPerusahaan
(
payload
).
then
(
response
=>
{
api
.
create
().
createPerusahaan
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -387,11 +449,22 @@ export default class Perusahaan extends Component {
...
@@ -387,11 +449,22 @@ export default class Perusahaan extends Component {
api
.
create
().
uploadPerusahaan
(
this
.
state
.
payload
).
then
(
response
=>
{
api
.
create
().
uploadPerusahaan
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
"success"
)
{
if
(
response
.
data
.
status
==
"success"
)
{
this
.
getData
()
this
.
getData
()
this
.
setState
({
visiblePerusahaan
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
visiblePerusahaan
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
...
src/container/MasterData/Perusahaan/VisualPerusahaan.js
View file @
72957447
...
@@ -7,6 +7,7 @@ import Nestable from 'react-nestable/dist/Nestable';
...
@@ -7,6 +7,7 @@ import Nestable from 'react-nestable/dist/Nestable';
import
AddIcon
from
'@material-ui/icons/Add'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
import
api
from
'../../../api'
;
import
api
from
'../../../api'
;
import
Constant
from
'../../../library/Constant'
;
const
Alert
=
withStyles
({
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
@@ -55,11 +56,22 @@ export default class VisualPerusahaan extends Component {
...
@@ -55,11 +56,22 @@ export default class VisualPerusahaan extends Component {
api
.
create
().
getPerusahaanHierarki
().
then
((
response
)
=>
{
api
.
create
().
getPerusahaanHierarki
().
then
((
response
)
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
items
:
response
.
data
.
data
})
this
.
setState
({
items
:
response
.
data
.
data
})
console
.
log
(
response
.
data
.
data
)
console
.
log
(
response
.
data
.
data
)
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -89,8 +101,26 @@ export default class VisualPerusahaan extends Component {
...
@@ -89,8 +101,26 @@ export default class VisualPerusahaan extends Component {
"company"
:
this
.
state
.
items
"company"
:
this
.
state
.
items
}
}
api
.
create
().
saveVisualisasiPerusahaan
(
payload
).
then
((
response
)
=>
{
api
.
create
().
saveVisualisasiPerusahaan
(
payload
).
then
((
response
)
=>
{
// if (response.data.status == 'ucces') {
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
props
.
onClickClose
()
this
.
props
.
onClickClose
()
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
// } else {
// } else {
// alert(response.data.message)
// alert(response.data.message)
// }
// }
...
...
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