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

Account removal #83

Merged
merged 2 commits into from
Apr 22, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading