mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: ✨ Add error page when an account is not found
This commit is contained in:
parent
46193938fe
commit
3db36ae618
4 changed files with 92 additions and 8 deletions
|
|
@ -1,10 +1,12 @@
|
|||
<template>
|
||||
<div class="mx-auto max-w-2xl w-full">
|
||||
<LazyTimelinesTimelineScroller>
|
||||
<LazySocialElementsUsersAccount :account="account ?? undefined" />
|
||||
<LazyTimelinesAccount :id="accountId" :key="accountId" />
|
||||
</LazyTimelinesTimelineScroller>
|
||||
</div>
|
||||
<ErrorsErrorBoundary>
|
||||
<div class="mx-auto max-w-2xl w-full">
|
||||
<LazyTimelinesTimelineScroller>
|
||||
<LazySocialElementsUsersAccount :account="account ?? undefined" />
|
||||
<LazyTimelinesAccount :id="accountId" :key="accountId" />
|
||||
</LazyTimelinesTimelineScroller>
|
||||
</div>
|
||||
</ErrorsErrorBoundary>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
|
@ -19,6 +21,17 @@ const client = useClient();
|
|||
const username = (route.params.username as string).replace("@", "");
|
||||
|
||||
const accounts = useAccountSearch(client, username);
|
||||
watch(accounts, (newValue) => {
|
||||
if (Array.isArray(newValue)) {
|
||||
if (!newValue.find((account) => account.acct === username)) {
|
||||
useEvent("error", {
|
||||
title: "Account not found",
|
||||
message: `The account <code>@${username}</code> does not exist.`,
|
||||
code: "ERR_ACCOUNT_NOT_FOUND",
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
const account = computed<Account | null>(
|
||||
() => accounts.value?.find((account) => account.acct === username) ?? null,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue