Skip to content

Commit

Permalink
missed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MVarshini committed May 9, 2023
1 parent cfa0f6d commit ff440b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
21 changes: 7 additions & 14 deletions dashboard/src/actions/datasetListActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,13 @@ export const fetchPublicDatasets = (page) => async (dispatch, getState) => {
payload: publicData,
});
// in case of last page, next_url is empty
if (response.data.next_url) {
const urlSearchParams = new URLSearchParams(response.data.next_url);
const offset = urlSearchParams.get("offset");

dispatch({
type: TYPES.SET_RESULT_OFFSET,
payload: Number(offset),
});
} else {
dispatch({
type: TYPES.SET_RESULT_OFFSET,
payload: Number(response.data.total),
});
}
const offset = response.data.next_url
? new URLSearchParams(response.data.next_url).get("offset")
: response.data.total;
dispatch({
type: TYPES.SET_RESULT_OFFSET,
payload: Number(offset),
});
}
} catch (error) {
dispatch(showToast(DANGER, ERROR_MSG));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ const DatePickerWidget = (props) => {
const onToChange = (_event, _str, date) => {
if (isValidDate(date)) {
dispatch(setFilterKeys(filter.startDate, date));
checkEndDate(filter.startDate, date);
} else {
setIsEndDateError(true);
}
checkEndDate(filter.startDate, date);
};
const checkEndDate = (fromDate, toDate) =>
new Date(fromDate) >= new Date(toDate)
? setIsEndDateError(true)
: setIsEndDateError(false);
setIsEndDateError(fromDate >= toDate);

const filterByDate = () => {
if (filter.startDate) {
Expand Down

0 comments on commit ff440b7

Please sign in to comment.