Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app-710/Close account endpoint is connected to the app. #716

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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