mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
refactor: ♻️ Make auth store require less null checks
This commit is contained in:
parent
68e23a818a
commit
b23ed66401
32 changed files with 111 additions and 124 deletions
|
|
@ -45,8 +45,8 @@
|
|||
{{ m.active_trite_lark_inspire() }}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
<DropdownMenuSeparator v-if="authStore.isSignedIn && !isMe" />
|
||||
<DropdownMenuGroup v-if="authStore.isSignedIn && !isMe">
|
||||
<DropdownMenuSeparator v-if="!isMe" />
|
||||
<DropdownMenuGroup v-if="!isMe">
|
||||
<DropdownMenuItem as="button" @click="muteUser(account.id)">
|
||||
<VolumeX />
|
||||
{{ m.spare_wild_mole_intend() }}
|
||||
|
|
@ -63,8 +63,8 @@
|
|||
{{ m.slow_chunky_chipmunk_hush() }}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
<DropdownMenuSeparator v-if="authStore.isSignedIn && !isMe" />
|
||||
<DropdownMenuGroup v-if="authStore.isSignedIn && !isMe">
|
||||
<DropdownMenuSeparator v-if="!isMe" />
|
||||
<DropdownMenuGroup v-if="!isMe">
|
||||
<DropdownMenuItem as="button" :disabled="true">
|
||||
<Flag />
|
||||
{{ m.great_few_jaguar_rise() }}
|
||||
|
|
@ -104,7 +104,7 @@ const { account } = defineProps<{
|
|||
}>();
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const isMe = authStore.account?.id === account.id;
|
||||
const isMe = authStore.accountOptional?.id === account.id;
|
||||
|
||||
const { copy } = useClipboard();
|
||||
const copyText = (text: string) => {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const roles = account.roles.filter((r) => r.visible);
|
|||
// Get user handle in username@instance format
|
||||
const handle = account.acct.includes("@")
|
||||
? account.acct
|
||||
: `${account.acct}@${authStore.instance?.domain ?? window.location.host}`;
|
||||
: `${account.acct}@${authStore.instance.domain}`;
|
||||
const isDeveloper = config.DEVELOPER_HANDLES.includes(handle);
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<Button
|
||||
variant="secondary"
|
||||
:disabled="isLoading || relationship?.requested"
|
||||
v-if="!isMe && authStore.isSignedIn"
|
||||
v-if="!isMe"
|
||||
@click="relationship?.following ? unfollow() : follow()"
|
||||
>
|
||||
<Loader v-if="isLoading" class="animate-spin" />
|
||||
|
|
@ -31,7 +31,7 @@ const { account } = defineProps<{
|
|||
|
||||
const { relationship, isLoading } = useRelationship(account.id);
|
||||
const authStore = useAuthStore();
|
||||
const isMe = authStore.account?.id === account.id;
|
||||
const isMe = authStore.accountOptional?.id === account.id;
|
||||
|
||||
const follow = async () => {
|
||||
if (preferences.confirm_actions.value.includes("follow")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue