AOSSIE-Org / AOSSIE-Org/Resonate

Refactor ApiService to improve robustness and eliminate duplicated execution logic

Ouverte
#766 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Dart
Étoiles
344
Forks
350
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.