Skip to content

Commit

Permalink
AREG-135 improve initial lastupdate text
Browse files Browse the repository at this point in the history
  • Loading branch information
D-GopalKrishna committed Apr 22, 2024
1 parent 67aaa46 commit 385a240
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions applications/portal/frontend/src/context/search/SearchState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface SearchResult {
const SearchState = (props) => {
const [baseData, setBaseData] = useState({
total: 0,
lastupdate: new Date(),
lastupdate: '-',
error: false
});
const [filterModel, setFilterModel] = useState<GridFilterModel>({ items: [] });
Expand All @@ -46,10 +46,11 @@ const SearchState = (props) => {
})

useEffect(() => {
getDataInfo().then((res) =>
setBaseData({ total: res.total, lastupdate: new Date(res.lastupdate), error: false })
).catch((err) => {
setBaseData({ total: 0, lastupdate: new Date(), error: true })
getDataInfo().then((res) => {
const lastUpdate = new Date(res.lastupdate)
setBaseData({ total: res.total, lastupdate: lastUpdate.toDateString(), error: false })
}).catch((err) => {
setBaseData({ total: 0, lastupdate: '-', error: true })
console.error("Error: ", err)
})
}, [])
Expand Down

0 comments on commit 385a240

Please sign in to comment.