Skip to content

Commit

Permalink
Fix injection and contenttype.
Browse files Browse the repository at this point in the history
  • Loading branch information
TammiLion committed Nov 20, 2024
1 parent e2a6db6 commit 43bfce3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/features/family/app/injection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void initCubits() {
..registerLazySingleton<GiveCubit>(
() => GiveCubit(
getIt(),
getIt(),
),
)
..registerLazySingleton<OrganisationBloc>(
Expand Down
14 changes: 11 additions & 3 deletions lib/features/family/network/family_api_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,12 @@ class FamilyAPIService {

Future<bool> updateGame(String gameGuid, Map<String, dynamic> body) async {
final url = Uri.https(_apiURL, '/givtservice/v1/game/$gameGuid');
final response = await client.put(url, body: jsonEncode(body));
final response = await client.put(url,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: jsonEncode(body));
if (response.statusCode >= 300) {
throw GivtServerFailure(
statusCode: response.statusCode,
Expand All @@ -357,8 +362,11 @@ class FamilyAPIService {
}

Future<String> createGame() async {
final url = Uri.https(_apiURL, '/givtservice/v1/game');
final response = await client.post(url);
final url = Uri.https(_apiURL, '/givtservice/v1/Game');
final response = await client.post(url, headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
}, body: jsonEncode({}));
if (response.statusCode >= 300) {
throw GivtServerFailure(
statusCode: response.statusCode,
Expand Down

0 comments on commit 43bfce3

Please sign in to comment.