fix: removing dead init code
parent
f2032c9287
commit
9d032856cc
|
@ -9,10 +9,6 @@ import "../../settings.dart";
|
||||||
class ContactApiProvider {
|
class ContactApiProvider {
|
||||||
CacheHttp cache = CacheHttp();
|
CacheHttp cache = CacheHttp();
|
||||||
|
|
||||||
Future<void> init() async {
|
|
||||||
await this.cache.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<List<User>> fetchContacts() async {
|
Future<List<User>> fetchContacts() async {
|
||||||
try {
|
try {
|
||||||
final responseBody =
|
final responseBody =
|
||||||
|
|
|
@ -12,10 +12,6 @@ import "../../settings.dart";
|
||||||
class ConversationApiProvider {
|
class ConversationApiProvider {
|
||||||
CacheHttp cache = CacheHttp();
|
CacheHttp cache = CacheHttp();
|
||||||
|
|
||||||
Future<void> init() async {
|
|
||||||
await this.cache.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Conversation> createConversation(String title) async {
|
Future<Conversation> createConversation(String title) async {
|
||||||
final response = await http.post("$baseUrlCore/user/conversation",
|
final response = await http.post("$baseUrlCore/user/conversation",
|
||||||
headers: {"Content-Type": "application/json"},
|
headers: {"Content-Type": "application/json"},
|
||||||
|
|
|
@ -9,11 +9,6 @@ import "../../settings.dart";
|
||||||
class UserApiProvider {
|
class UserApiProvider {
|
||||||
CacheHttp cache;
|
CacheHttp cache;
|
||||||
|
|
||||||
Future<void> init() async {
|
|
||||||
this.cache = new CacheHttp();
|
|
||||||
await this.cache.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<User> createUser(User user) async {
|
Future<User> createUser(User user) async {
|
||||||
// Prob need to add the headers
|
// Prob need to add the headers
|
||||||
final response = await http.post("$baseUrlCore/user",
|
final response = await http.post("$baseUrlCore/user",
|
||||||
|
@ -24,9 +19,10 @@ class UserApiProvider {
|
||||||
|
|
||||||
Future<User> fetchUserByPhone(String phoneNumber) async {
|
Future<User> fetchUserByPhone(String phoneNumber) async {
|
||||||
try {
|
try {
|
||||||
final responseBody = await this.cache.fetch("$baseUrlCore/user?phone_number=$phoneNumber");
|
final responseBody =
|
||||||
|
await this.cache.fetch("$baseUrlCore/user?phone_number=$phoneNumber");
|
||||||
return User.fromJson(jsonDecode(responseBody));
|
return User.fromJson(jsonDecode(responseBody));
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +31,7 @@ class UserApiProvider {
|
||||||
try {
|
try {
|
||||||
final responseBody = await this.cache.fetch("$baseUrlCore/user/id/$id");
|
final responseBody = await this.cache.fetch("$baseUrlCore/user/id/$id");
|
||||||
return User.fromJson(jsonDecode(responseBody));
|
return User.fromJson(jsonDecode(responseBody));
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue