AOSSIE-Org / AOSSIE-Org/Resonate

Refactor ApiService to improve robustness and eliminate duplicated execution logic

Offen
#766 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Dart
Sterne
344
Forks
350
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### 🐛 Describe the bug

A clear and concise description of what the bug is.

The current ApiService implementation repeats the same function execution logic across multiple methods (createRoom, joinRoom, deleteRoom, createLiveChapterRoom, etc.).

Each method individually:
- Calls an Appwrite function
- Checks for HTTP 200 status
- Decodes the JSON response
- Returns Map

This results in duplicated logic and assumes that:
- The response body is always valid JSON
- The decoded value is always a JSON object (Map)
- The function call will always return without hanging

If the response format changes or returns malformed JSON, jsonDecode may throw a runtime error. Additionally, the current implementation has no timeout protection, meaning a hanging function call could block indefinitely.

This is not currently causing a visible bug, but it introduces unnecessary risk and maintenance overhead.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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