Fakultas Ilmu Komputer UI

Commit c68c3754 authored by Yoga Pratama's avatar Yoga Pratama
Browse files

[CHORES] Add fetch image logic

parent cf13d486
......@@ -10,8 +10,23 @@ class KegiatanTerdekatRepository implements BaseKegiatanTerdekatRepository {
@override
Future fetchKegiatanTerdekatResponse() async {
final response = await _network.get(
url: '/informasi-fasilitas/lokasi/kegiatan-terdekat',isLogin: false);
url: '/informasi-fasilitas/lokasi/kegiatan-terdekat', isLogin: false);
var kegiatan = KegiatanModel.fromJson(response);
kegiatan.image = await fetchFotoKegiatan(kegiatan.placeId, kegiatan.id);
return kegiatan;
}
}
\ No newline at end of file
Future<List<String>> fetchFotoKegiatan(String placeId, int kegiatanId) async {
final response = await _network.get(
url:
'/informasi-fasilitas/lokasi/list-foto-kegiatan/$placeId/$kegiatanId',
isLogin: false);
final List<String> data = response.values
.toList()
.map<String>((element) => element['foto'].toString())
.toList();
return data;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment