AOSSIE-Org / AOSSIE-Org/Resonate

Refactor ApiService to improve robustness and eliminate duplicated execution logic

Aperta
#766 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
344
Fork
350
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 🐛 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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.