More redux work. User creation/retrieve
This commit is contained in:
parent
2c67b68512
commit
2dfa745c6a
16 changed files with 212 additions and 110 deletions
|
|
@ -1,14 +1,39 @@
|
|||
import 'yourLocation.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart' as ht;
|
||||
import 'package:jaguar_resty/jaguar_resty.dart' as resty;
|
||||
|
||||
import 'appState.dart';
|
||||
import 'yourLocation.dart';
|
||||
|
||||
class FiresApi {
|
||||
|
||||
Future<String> createUser(String token) async {
|
||||
|
||||
FiresApi() {
|
||||
resty.globalClient = new ht.IOClient();
|
||||
}
|
||||
|
||||
Future<List<YourLocation>> fetchYourLocations() async {
|
||||
Future<String> createUser(AppState state, String token, String lang) async {
|
||||
assert(state.firesApiUrl != null);
|
||||
assert(state.firesApiKey != null);
|
||||
assert(token != null);
|
||||
assert(lang != null);
|
||||
|
||||
final params = {
|
||||
"token": state.firesApiKey,
|
||||
"mobileToken": token,
|
||||
"lang": lang
|
||||
};
|
||||
final url = '${state.firesApiUrl}mobile/users';
|
||||
/* print(url);
|
||||
print(params); */
|
||||
String resp = await resty.post(url).json(params).go().then((response) {
|
||||
if (response.statusCode == 200) {
|
||||
// print(response.body);
|
||||
return json.decode(response.body)['data']['userId'];
|
||||
}
|
||||
});
|
||||
return resp;
|
||||
}
|
||||
|
||||
Future<List<YourLocation>> fetchYourLocations() async {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue