diff --git a/apps/expo/src/app/sync/login.tsx b/apps/expo/src/app/sync/login.tsx
index 4381803..b267169 100644
--- a/apps/expo/src/app/sync/login.tsx
+++ b/apps/expo/src/app/sync/login.tsx
@@ -100,7 +100,7 @@ export default function Page() {
Login
{mutation.isError && (
-
+
{mutation.error.message}
)}
diff --git a/apps/expo/src/app/sync/register/account.tsx b/apps/expo/src/app/sync/register/account.tsx
index b4dd052..4c6a3e9 100644
--- a/apps/expo/src/app/sync/register/account.tsx
+++ b/apps/expo/src/app/sync/register/account.tsx
@@ -102,7 +102,7 @@ export default function Page() {
{errorMessage && (
-
+
{errorMessage}
)}
diff --git a/apps/expo/src/app/sync/register/confirm.tsx b/apps/expo/src/app/sync/register/confirm.tsx
index 5e38b26..5f2ebf6 100644
--- a/apps/expo/src/app/sync/register/confirm.tsx
+++ b/apps/expo/src/app/sync/register/confirm.tsx
@@ -88,7 +88,7 @@ export default function Page() {
{mutation.isError && (
-
+
{mutation.error.message}
)}
diff --git a/apps/expo/src/components/account/AccountInformation.tsx b/apps/expo/src/components/account/AccountInformation.tsx
index 2ddae11..f298e42 100644
--- a/apps/expo/src/components/account/AccountInformation.tsx
+++ b/apps/expo/src/components/account/AccountInformation.tsx
@@ -1,6 +1,6 @@
import { useMemo } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { Spinner, Text, XStack, YStack } from "tamagui";
+import { H3, Spinner, Text, XStack, YStack } from "tamagui";
import {
base64ToBuffer,
@@ -17,6 +17,7 @@ import { MWCard } from "../ui/Card";
import { MWInput } from "../ui/Input";
import { MWSeparator } from "../ui/Separator";
import { Avatar } from "./Avatar";
+import { DeleteAccountAlert } from "./DeleteAccountAlert";
import { getExpoIconFromDbIcon } from "./UserIconPicker";
export function AccountInformation() {
@@ -115,6 +116,11 @@ export function AccountInformation() {
{sessions.isLoading && }
+ {sessions.isError && (
+
+ Error loading sessions
+
+ )}
{deviceListSorted.map((device) => (
@@ -136,6 +142,23 @@ export function AccountInformation() {
))}
+
+
+
+ Actions
+
+
+
+
+ Delete account
+
+ This action is irreversible. All data will be deleted and
+ nothing can be recovered.
+
+
+
+
+
);
diff --git a/apps/expo/src/components/account/DeleteAccountAlert.tsx b/apps/expo/src/components/account/DeleteAccountAlert.tsx
new file mode 100644
index 0000000..19f827c
--- /dev/null
+++ b/apps/expo/src/components/account/DeleteAccountAlert.tsx
@@ -0,0 +1,86 @@
+import { useMutation } from "@tanstack/react-query";
+import { AlertDialog, XStack, YStack } from "tamagui";
+
+import { deleteUser } from "@movie-web/api";
+
+import { useAuth } from "~/hooks/useAuth";
+import { useAuthStore } from "~/stores/settings";
+import { MWButton } from "../ui/Button";
+
+export function DeleteAccountAlert() {
+ const account = useAuthStore((state) => state.account);
+ const backendUrl = useAuthStore((state) => state.backendUrl);
+ const { logout } = useAuth();
+
+ const logoutMutation = useMutation({
+ mutationKey: ["logout"],
+ mutationFn: logout,
+ });
+
+ const deleteAccountMutation = useMutation({
+ mutationKey: ["deleteAccount"],
+ mutationFn: () => deleteUser(backendUrl, account!),
+ onSuccess: () => {
+ logoutMutation.mutate();
+ },
+ });
+
+ return (
+
+
+
+ Delete account
+
+
+
+
+
+
+
+ Are you sure?
+
+ This action is irreversible. All data will be deleted and nothing
+ can be recovered.
+
+
+
+
+ Cancel
+
+ deleteAccountMutation.mutate()}
+ >
+ I am sure
+
+
+
+
+
+
+ );
+}