Skip to content

Commit

Permalink
move get owners into a different function
Browse files Browse the repository at this point in the history
  • Loading branch information
mrquantumoff committed Jul 21, 2024
1 parent 8efcf11 commit 05e80dd
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/pages/modpack_importer/import_modpacks/synced_modpack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ class _SyncedModpackState extends State<SyncedModpack> {
}
}

Future<dynamic> getOwners() async {
http.Response res = await http.get(
Uri.parse(
"https://api.mrquantumoff.dev/api/v3/quadrant/sync/get?show_owners=true&modpack_id=${widget.modpackId}"),
headers: {
"User-Agent": await generateUserAgent(),
"Authorization": "Bearer ${widget.token}"
},
);

return res;
}

return Card(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 24),
Expand Down Expand Up @@ -185,18 +198,7 @@ class _SyncedModpackState extends State<SyncedModpack> {
Container(
margin: const EdgeInsets.only(left: 32),
child: FutureBuilder(
future: () async {
http.Response res = await http.get(
Uri.parse(
"https://api.mrquantumoff.dev/api/v3/quadrant/sync/get?show_owners=true&modpack_id=${widget.modpackId}"),
headers: {
"User-Agent": await generateUserAgent(),
"Authorization": "Bearer ${widget.token}"
},
);

return res;
}(),
future: getOwners(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const Center(
Expand Down

0 comments on commit 05e80dd

Please sign in to comment.