Skip to content

Commit

Permalink
- update ternary
Browse files Browse the repository at this point in the history
- Add undefined checks
  • Loading branch information
elipe17 committed Nov 21, 2024
1 parent f412d73 commit 3e786ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tdrs-frontend/src/actions/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ export const setStt = (stt) => async (dispatch) => {
const data = await axiosInstance.get(URL, {
withCredentials: true,
})
const newUploadSections = Object.keys(data.filenames)
const newUploadSections =
typeof data !== 'undefined' ? Object.keys(data.filenames) : []
dispatch({ type: SET_SELECTED_STT, payload: { stt, newUploadSections } })
}
export const setYear = (year) => (dispatch) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const SubmissionHistory = ({ filterValues }) => {
</div>
<div>
{defaultFileUploadSections.map((section, index) => {
if (fileUploadSections.includes(section)) {
if (fileUploadSections?.includes(section)) {
return (
<SectionSubmissionHistory
key={section}
Expand Down
2 changes: 1 addition & 1 deletion tdrs-frontend/src/components/UploadReport/UploadReport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function UploadReport({ handleCancel, stt }) {
)}
<form onSubmit={onSubmit}>
{defaultFileUploadSections.map((section, index) => {
if (fileUploadSections.includes(section)) {
if (fileUploadSections?.includes(section)) {
return (
<FileUpload
key={section}
Expand Down

0 comments on commit 3e786ec

Please sign in to comment.