hooked up all items on the list settings section

This commit is contained in:
Edward Tirado Jr 2026-04-05 00:36:20 -05:00
parent 53df349d9f
commit 91173021b2
32 changed files with 578 additions and 178 deletions

View file

@ -0,0 +1,62 @@
<script lang="ts" setup>
const route = useRoute();
const token = route.params.token as string;
let isAuthorized = ref(false);
let isProcessed = ref(false);
let failed = ref(false);
enum InviteStatusEnum {
PENDING = "pending",
ACCEPTED = "accepted",
DECLINED = "declined",
NOT_FOUND = "not_found",
FAILED = "failed",
}
type InviteStatus = {
message: string
status: InviteStatusEnum
}
// check if the email from the invite has an existing user
const acceptInvitation = () => {
$api<InviteStatus>(`/api/invitations/${token}/accept`, {
method: "GET",
onResponseError({response}) {
if (response.status === 401) {
isAuthorized.value = false
isProcessed.value = true
return;
}
failed.value = true;
return;
}
}).then((invitationStatus) => {
navigateTo('/lists')
})
}
acceptInvitation();
</script>
<template>
<div v-if="!isAuthorized && !isProcessed && !failed">
<span>Processing...</span>
</div>
<div v-else-if="!isAuthorized && isProcessed && !failed">
<span>You need to <NuxtLink to="/auth/login">log in</NuxtLink> or <NuxtLink
to="/auth/register">create an account</NuxtLink></span>
</div>
<div v-show="failed">
<span>An error occurred while accepting the request.</span>
</div>
</template>
<style scoped>
</style>

View file

@ -0,0 +1,11 @@
<script lang="ts" setup>
</script>
<template>
</template>
<style scoped>
</style>