+
You're Joining an Existing Group!
+
+
diff --git a/frontend/pages/profile.vue b/frontend/pages/profile.vue
index 013fda5..165b489 100644
--- a/frontend/pages/profile.vue
+++ b/frontend/pages/profile.vue
@@ -144,25 +144,12 @@
name: "Email",
text: auth.self?.email || "Unknown",
},
- {
- name: "Invitation Code",
- text: "",
- slot: "invitation",
- },
- {
- name: "Change Password",
- text: "",
- slot: "change-password",
- },
- {
- name: "Delete Profile",
- text: "",
- slot: "delete-profile",
- },
] as Detail[];
});
+ const api = useUserApi();
const confirm = useConfirm();
+ const notify = useNotifier();
async function deleteProfile() {
const result = await confirm.open(
@@ -173,7 +160,37 @@
return;
}
- console.log("delete profile");
+ const { response } = await api.user.delete();
+
+ if (response?.status === 204) {
+ notify.success("Your account has been deleted.");
+ auth.logout(api);
+ navigateTo("/");
+ }
+
+ notify.error("Failed to delete your account.");
+ }
+
+ const token = ref("");
+ const tokenUrl = computed(() => {
+ if (!window) {
+ return "";
+ }
+
+ return `${window.location.origin}?token=${token.value}`;
+ });
+
+ async function generateToken() {
+ const date = new Date();
+
+ const { response, data } = await api.group.createInvitation({
+ expiresAt: new Date(date.setDate(date.getDate() + 7)),
+ uses: 1,
+ });
+
+ if (response?.status === 201) {
+ token.value = data.token;
+ }
}
@@ -182,23 +199,28 @@
-
+
User Profile
Invite users, and manage your account.
-
-
- Generate Invite Link
-
-
- Change Password
-
-
- Delete Profile
-
-
+
+
+
+
+ Change Password
+ Generate Invite Link
+
+
+
+ {{ tokenUrl }}
+
+
+
+ {{ token }}
+
+
@@ -251,6 +273,20 @@
+
+