Browse Source

set last company id

pull/1/head
wahyuun 8 months ago
parent
commit
5f1f47d7e9
  1. 12
      src/views/Master/MasterCompany/index.js

12
src/views/Master/MasterCompany/index.js

@ -125,11 +125,13 @@ const MasterCompany = ({ params }) => {
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
const sourceData = result.data.data; const sourceData = result.data.data;
const countRecord = result.data.totalRecord;
setDatatable(sourceData); setDatatable(sourceData);
setTotalPage(result.data.totalRecord); setTotalPage(countRecord);
const lastCompanyId = sourceData[sourceData.length - 1].id; const lastCompanyId = countRecord > 0 ? sourceData[sourceData.length - 1].id : null;
setLastCompanyId(lastCompanyId); setLastCompanyId(lastCompanyId);
setLoading(false) setLoading(false)
} else { } else {
@ -187,7 +189,7 @@ const MasterCompany = ({ params }) => {
const sourceData = result.data.data; const sourceData = result.data.data;
setProjectImageSlider(sourceData); setProjectImageSlider(sourceData);
} }
} }
const handleSearch = e => { const handleSearch = e => {
const value = e.target.value const value = e.target.value

Loading…
Cancel
Save