mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-30 13:19:16 +03:00
Better error state for Account sheet
Some accounts… can't be resolved by the API
This commit is contained in:
parent
285f8b46f2
commit
dda83c7834
1 changed files with 141 additions and 130 deletions
|
@ -41,10 +41,8 @@ function Account({ account }) {
|
|||
setUIState('default');
|
||||
return;
|
||||
}
|
||||
alert('Account not found');
|
||||
setUIState('error');
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
console.error(err);
|
||||
setUIState('error');
|
||||
}
|
||||
|
@ -123,7 +121,17 @@ function Account({ account }) {
|
|||
id="account-container"
|
||||
class={`sheet ${uiState === 'loading' ? 'skeleton' : ''}`}
|
||||
>
|
||||
{!info || uiState === 'loading' ? (
|
||||
{uiState === 'error' && (
|
||||
<div class="ui-state">
|
||||
<p>Unable to load account.</p>
|
||||
<p>
|
||||
<a href={account} target="_blank">
|
||||
Go to account page <Icon icon="external" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{uiState === 'loading' ? (
|
||||
<>
|
||||
<header>
|
||||
<Avatar size="xxxl" />
|
||||
|
@ -142,6 +150,7 @@ function Account({ account }) {
|
|||
</main>
|
||||
</>
|
||||
) : (
|
||||
info && (
|
||||
<>
|
||||
<header>
|
||||
<Avatar url={avatar} size="xxxl" />
|
||||
|
@ -236,12 +245,13 @@ function Account({ account }) {
|
|||
: 'Are you sure that you want to unfollow this account?',
|
||||
);
|
||||
if (yes) {
|
||||
newRelationship = await masto.v1.accounts.unfollow(
|
||||
id,
|
||||
);
|
||||
newRelationship =
|
||||
await masto.v1.accounts.unfollow(id);
|
||||
}
|
||||
} else {
|
||||
newRelationship = await masto.v1.accounts.follow(id);
|
||||
newRelationship = await masto.v1.accounts.follow(
|
||||
id,
|
||||
);
|
||||
}
|
||||
if (newRelationship) setRelationship(newRelationship);
|
||||
setRelationshipUIState('default');
|
||||
|
@ -274,6 +284,7 @@ function Account({ account }) {
|
|||
</p>
|
||||
</main>
|
||||
</>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue