Skip to content

Commit 9219a1f

Browse files
authored
Merge pull request #2675 from objectcomputing/bugfix-2674/require-skill-for-skills-report
Require a skill to be selected before POSTing to the server.
2 parents 1aa9577 + d5616dd commit 9219a1f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

web-ui/src/pages/SkillReportPage.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useContext, useRef, useState } from 'react';
33
import { Button, TextField } from '@mui/material';
44
import Autocomplete from '@mui/material/Autocomplete';
55

6+
import { UPDATE_TOAST } from '../context/actions';
67
import { AppContext } from '../context/AppContext';
78
import { reportSkills } from '../api/memberskill.js';
89
import SearchResults from '../components/search-results/SearchResults';
@@ -126,7 +127,17 @@ const SkillReportPage = props => {
126127
<div className="SkillsSearch-actions fullWidth">
127128
<Button
128129
onClick={() => {
129-
handleSearch(createRequestDTO(editedSearchRequest));
130+
if (!searchSkills.length) {
131+
window.snackDispatch({
132+
type: UPDATE_TOAST,
133+
payload: {
134+
severity: 'error',
135+
toast: 'Must select a skill'
136+
}
137+
});
138+
} else {
139+
handleSearch(createRequestDTO(editedSearchRequest));
140+
}
130141
}}
131142
color="primary"
132143
>

0 commit comments

Comments
 (0)