Skip to content

Commit

Permalink
Merge pull request #716 from bounswe/710-connect-the-app-settings-to-…
Browse files Browse the repository at this point in the history
…close-account-endpoint

app-710/Close account endpoint is connected to the app.
  • Loading branch information
tbaturhanakbulut committed Dec 23, 2023
2 parents 56e9f5c + 5a9c702 commit c1a3cc2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions app/mobile/lib/services/accountClosingService.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import 'package:mobile_app/services/apiService.dart';

class AccountClosingService {

Future<Response> closeAccount() async {
const String closeAccountEndpoint =
'/user/close-account'; //if exists
Future<Response> closeAccount(String userID) async {
String closeAccountEndpoint =
'/user/$userID'; //if exists

final Map<String, String> data = {};


print(closeAccountEndpoint);
try {
final Response response = await ApiService.dio.post(
final Response response = await ApiService.dio.delete(
closeAccountEndpoint,
data: data,
);
Expand Down
1 change: 1 addition & 0 deletions app/mobile/lib/view/settings/editPasswordPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class _EditPasswordPageState extends State<EditPasswordPage> {
labelText: 'Old Password',
controller: oldPasswordController,
errorText: "",
obscureText: true,

),
const SizedBox(height: 10.0),
Expand Down
5 changes: 3 additions & 2 deletions app/mobile/lib/view/settings/settingsPage.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:mobile_app/services/accountClosingService.dart';
import 'package:mobile_app/view/state.dart';
import 'package:mobile_app/view/welcome/welcome.dart';

import '../../ScreenArguments.dart';
Expand Down Expand Up @@ -63,8 +64,8 @@ class _SettingsPageState extends State<SettingsPage> {

try {

Response response = await accountClosingService.closeAccount();
if(response.statusCode == 201) {
Response response = await accountClosingService.closeAccount(AppState.loggedInUserId);
if(response.statusCode == 200) {

if(!context.mounted) return;
Navigator.pushNamedAndRemoveUntil(
Expand Down

0 comments on commit c1a3cc2

Please sign in to comment.