mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 08:24:05 +02:00
clean up and use const
This commit is contained in:
parent
20076fc11c
commit
206d49c069
@ -3,7 +3,6 @@ import 'package:mobile/controllers/routing.dart';
|
||||
import 'package:mobile/controllers/cart.dart';
|
||||
import 'package:mobile/controllers/paying_state.dart';
|
||||
import 'package:mobile/controllers/receipt.dart';
|
||||
import 'package:mobile/controllers/session.dart';
|
||||
import 'package:mobile/results.dart';
|
||||
import 'package:mobile/utils/price.dart';
|
||||
import 'package:mobile/widgets/primary_button.dart';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mobile/controllers/session.dart';
|
||||
import 'package:mobile/results.dart';
|
||||
import 'package:mobile/utils/build_if_session_exists.dart';
|
||||
import 'package:mobile/utils/price.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
@ -49,7 +49,7 @@ class BackendServer implements Server {
|
||||
).then((res) => json.decode(res.body));
|
||||
|
||||
if (res["ok"]) {
|
||||
return Ok(null);
|
||||
return const Ok(null);
|
||||
} else {
|
||||
return Err(res["msg"]);
|
||||
}
|
||||
@ -79,7 +79,7 @@ class BackendServer implements Server {
|
||||
).then((res) => json.decode(res.body));
|
||||
|
||||
if (res["ok"]) {
|
||||
return Ok(null);
|
||||
return const Ok(null);
|
||||
} else {
|
||||
return Err(res["msg"]);
|
||||
}
|
||||
@ -108,7 +108,7 @@ class BackendServer implements Server {
|
||||
{"product_id": cartItem.product.id, "amount": cartItem.amount})
|
||||
.toList()
|
||||
});
|
||||
print(items);
|
||||
(items);
|
||||
final res = await http
|
||||
.post(Uri.parse("$_apiUrl/carts/purchase"),
|
||||
headers: {
|
||||
@ -134,7 +134,6 @@ class BackendServer implements Server {
|
||||
|
||||
@override
|
||||
Future<Result<Null, String>> addBalance(String token) async {
|
||||
print("$_apiUrl/api/users/balance/add");
|
||||
final res = await http.post(
|
||||
Uri.parse("$_apiUrl/users/balance/add"),
|
||||
headers: {
|
||||
@ -145,7 +144,7 @@ class BackendServer implements Server {
|
||||
).then((res) => json.decode(res.body));
|
||||
|
||||
if (res["ok"]) {
|
||||
return Ok(null);
|
||||
return const Ok(null);
|
||||
} else {
|
||||
return Err(res["msg"]);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ class MockServer implements Server {
|
||||
String email,
|
||||
String password,
|
||||
) async {
|
||||
return Ok(null);
|
||||
return const Ok(null);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -105,12 +105,12 @@ class MockServer implements Server {
|
||||
String email,
|
||||
String password,
|
||||
) async {
|
||||
return Ok("asdsadasdsad");
|
||||
return const Ok("aasffsa");
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Result<Null, String>> logout(String token) async {
|
||||
return Ok(null);
|
||||
return const Ok(null);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -125,11 +125,11 @@ class MockServer implements Server {
|
||||
@override
|
||||
Future<Result<Null, String>> purchaseCart(
|
||||
String token, List<CartItem> cartItems) async {
|
||||
return Ok(null);
|
||||
return const Ok(null);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Result<Null, String>> addBalance(String token) async {
|
||||
return Ok(null);
|
||||
return const Ok(null);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mobile/controllers/session.dart';
|
||||
import 'package:mobile/models/user.dart';
|
Loading…
x
Reference in New Issue
Block a user