Skip to content

Commit

Permalink
Account removal (#83)
Browse files Browse the repository at this point in the history
* use latest iOS SDK

* Implement removeAccount function
  • Loading branch information
arash817 authored Apr 22, 2024
1 parent 26c9342 commit 62958c7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
8 changes: 6 additions & 2 deletions mobile/eas.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"cli": {
"version": ">= 2.2.1",
"appVersionSource": "remote"
"appVersionSource": "remote",
"promptToConfigurePushNotifications": false
},
"build": {
"development": {
Expand All @@ -21,8 +22,11 @@
},
"production": {
"autoIncrement": true,
"channel":"test",
"channel": "test",
"distribution": "store",
"ios": {
"image": "latest"
},
"env": {
"APP_ENV": "production",
"APP_NAME": "Quantoz Blockchain Services",
Expand Down
21 changes: 19 additions & 2 deletions mobile/src/screens/RemoveAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,32 @@ import {
theme,
} from "native-base";
import ScreenWrapper from "../components/ScreenWrapper";
import { paymentsApi } from "../utils/axios";
import { useAuth } from "../auth/AuthContext";
import { useNotification } from "../context/NotificationContext";

export function RemoveAccount() {
const auth = useAuth();
const [email, setEmail] = useState<string>("");
const [isLoading, setIsLoading] = useState(false);
const { showErrorNotification, showSuccessNotification } = useNotification();

const removeAccount = async () => {
setIsLoading(true);
// Temporary solution to simulate the removal of the account until the API is implemented
await new Promise((resolve) => setTimeout(resolve, 3000));
try {
const response = await paymentsApi.delete("/api/customers");
if (response.status === 201) {
showSuccessNotification("Account removed successfully");
} else {
showErrorNotification(
"Account removal failed. please contact support."
);
}
auth?.logout();
} catch (error) {
showErrorNotification("Account removal failed. please contact support.");
auth?.logout();
}
setIsLoading(false);
};

Expand Down

0 comments on commit 62958c7

Please sign in to comment.