mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 16:24:07 +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/cart.dart';
|
||||||
import 'package:mobile/controllers/paying_state.dart';
|
import 'package:mobile/controllers/paying_state.dart';
|
||||||
import 'package:mobile/controllers/receipt.dart';
|
import 'package:mobile/controllers/receipt.dart';
|
||||||
import 'package:mobile/controllers/session.dart';
|
|
||||||
import 'package:mobile/results.dart';
|
import 'package:mobile/results.dart';
|
||||||
import 'package:mobile/utils/price.dart';
|
import 'package:mobile/utils/price.dart';
|
||||||
import 'package:mobile/widgets/primary_button.dart';
|
import 'package:mobile/widgets/primary_button.dart';
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mobile/controllers/session.dart';
|
import 'package:mobile/controllers/session.dart';
|
||||||
import 'package:mobile/results.dart';
|
import 'package:mobile/results.dart';
|
||||||
import 'package:mobile/utils/build_if_session_exists.dart';
|
|
||||||
import 'package:mobile/utils/price.dart';
|
import 'package:mobile/utils/price.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class BackendServer implements Server {
|
|||||||
).then((res) => json.decode(res.body));
|
).then((res) => json.decode(res.body));
|
||||||
|
|
||||||
if (res["ok"]) {
|
if (res["ok"]) {
|
||||||
return Ok(null);
|
return const Ok(null);
|
||||||
} else {
|
} else {
|
||||||
return Err(res["msg"]);
|
return Err(res["msg"]);
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ class BackendServer implements Server {
|
|||||||
).then((res) => json.decode(res.body));
|
).then((res) => json.decode(res.body));
|
||||||
|
|
||||||
if (res["ok"]) {
|
if (res["ok"]) {
|
||||||
return Ok(null);
|
return const Ok(null);
|
||||||
} else {
|
} else {
|
||||||
return Err(res["msg"]);
|
return Err(res["msg"]);
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ class BackendServer implements Server {
|
|||||||
{"product_id": cartItem.product.id, "amount": cartItem.amount})
|
{"product_id": cartItem.product.id, "amount": cartItem.amount})
|
||||||
.toList()
|
.toList()
|
||||||
});
|
});
|
||||||
print(items);
|
(items);
|
||||||
final res = await http
|
final res = await http
|
||||||
.post(Uri.parse("$_apiUrl/carts/purchase"),
|
.post(Uri.parse("$_apiUrl/carts/purchase"),
|
||||||
headers: {
|
headers: {
|
||||||
@ -134,7 +134,6 @@ class BackendServer implements Server {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Result<Null, String>> addBalance(String token) async {
|
Future<Result<Null, String>> addBalance(String token) async {
|
||||||
print("$_apiUrl/api/users/balance/add");
|
|
||||||
final res = await http.post(
|
final res = await http.post(
|
||||||
Uri.parse("$_apiUrl/users/balance/add"),
|
Uri.parse("$_apiUrl/users/balance/add"),
|
||||||
headers: {
|
headers: {
|
||||||
@ -145,7 +144,7 @@ class BackendServer implements Server {
|
|||||||
).then((res) => json.decode(res.body));
|
).then((res) => json.decode(res.body));
|
||||||
|
|
||||||
if (res["ok"]) {
|
if (res["ok"]) {
|
||||||
return Ok(null);
|
return const Ok(null);
|
||||||
} else {
|
} else {
|
||||||
return Err(res["msg"]);
|
return Err(res["msg"]);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ class MockServer implements Server {
|
|||||||
String email,
|
String email,
|
||||||
String password,
|
String password,
|
||||||
) async {
|
) async {
|
||||||
return Ok(null);
|
return const Ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -105,12 +105,12 @@ class MockServer implements Server {
|
|||||||
String email,
|
String email,
|
||||||
String password,
|
String password,
|
||||||
) async {
|
) async {
|
||||||
return Ok("asdsadasdsad");
|
return const Ok("aasffsa");
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Result<Null, String>> logout(String token) async {
|
Future<Result<Null, String>> logout(String token) async {
|
||||||
return Ok(null);
|
return const Ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -125,11 +125,11 @@ class MockServer implements Server {
|
|||||||
@override
|
@override
|
||||||
Future<Result<Null, String>> purchaseCart(
|
Future<Result<Null, String>> purchaseCart(
|
||||||
String token, List<CartItem> cartItems) async {
|
String token, List<CartItem> cartItems) async {
|
||||||
return Ok(null);
|
return const Ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Result<Null, String>> addBalance(String token) async {
|
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