mirror of
https://github.com/supleed2/ELEC60013-ES-CW1.git
synced 2024-11-10 01:35:50 +00:00
21 lines
603 B
Dart
21 lines
603 B
Dart
import 'dart:convert';
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints;
|
|
|
|
class AuthService{
|
|
Future<List<String>> getUserDevices(sessionToken) async {
|
|
final response = await http.get(
|
|
Uri.parse(Endpoints.getUserDevices),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
'token': sessionToken,
|
|
},
|
|
);
|
|
List<dynamic> list = jsonDecode(response.body)['devices'];
|
|
List<String> res = [];
|
|
for (final l in list) {
|
|
res.add(l.toString());
|
|
}
|
|
return res;
|
|
}
|
|
} |