AOSSIE-Org / AOSSIE-Org/EduAid

[BUG]: Fix input validation and prevent unnecessary API calls in Text_Input.jsx

Offen
#608 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
JavaScript
Sterne
171
Forks
425
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Bug Description

### Problem

The Text_Input component allows API calls even when the input is invalid or incomplete:

- Clicking "Next" without entering text or URL still triggers processing
- Invalid or empty Google Doc URLs may lead to unintended API calls
- Number of questions can be set to 0, which should not be allowed
- Error handling is inconsistent for file uploads and API failures
- Unused state variables add unnecessary clutter to the component

### Expected Behavior

- API calls should only be made when valid input is provided
- Either text input, file upload, or a valid Google Doc URL must be present
- Number of questions must be greater than 0
- Errors should be clearly displayed to the user
- Code should not contain unused state or redundant logic

### Proposed Solution

- Add validation to prevent empty input submission
- Prevent API calls when question count is 0
- Improve handling of Google Doc URL responses
- Handle file upload errors more safely
- Remove unused state variables to clean up the code

### Steps to Reproduce

_No response_

### Logs and Screenshots

_No response_

### Environment Details

_No response_

### Impact

Critical - Application is unusable

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.