Skip to content

Commit

Permalink
Checking that response.content is of type string --> if not Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Catrovitch committed Aug 30, 2024
1 parent fc1ed73 commit 7a09194
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/client/pages/InventorsAssistant/FirstStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ const FirstStep: React.FC<FirstStepProps> = ({
const { content } = response.data

if (content.failed) {
feedbackState((prevState) => ({
...prevState,
aiInputFeedbackSuccess: 'warning',
aiInputFeedback: content.content,
}))
if (typeof content.content !== 'string') {
feedbackState((prevState) => ({
...prevState,
aiInputFeedbackSuccess: 'warning',
aiInputFeedback: 'An Error Occurred. Try submitting again',
}))
}
} else if (content.success === false) {
feedbackState((prevState) => ({
...prevState,
Expand Down

0 comments on commit 7a09194

Please sign in to comment.