update
This commit is contained in:
41
lib/services/destination_service.dart
Normal file
41
lib/services/destination_service.dart
Normal file
@ -0,0 +1,41 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
|
||||
class DestinationService{
|
||||
|
||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||
List<dynamic> cats = [];
|
||||
String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
}
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
return cats;
|
||||
}
|
||||
|
||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||
int cats = 0;
|
||||
String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
}
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user