diff --git a/components/modal/ModalContainer.vue b/components/modal/ModalContainer.vue
index 29ccff74..4dace15e 100644
--- a/components/modal/ModalContainer.vue
+++ b/components/modal/ModalContainer.vue
@@ -1,12 +1,12 @@
-
-
+
+
-
+
diff --git a/components/account/AccountSignIn.vue b/components/user/UserSignIn.vue
similarity index 100%
rename from components/account/AccountSignIn.vue
rename to components/user/UserSignIn.vue
diff --git a/components/account/AccountSignInEntry.vue b/components/user/UserSignInEntry.vue
similarity index 100%
rename from components/account/AccountSignInEntry.vue
rename to components/user/UserSignInEntry.vue
diff --git a/components/account/AccountSwitcher.vue b/components/user/UserSwitcher.vue
similarity index 73%
rename from components/account/AccountSwitcher.vue
rename to components/user/UserSwitcher.vue
index 64db7d82..bba938f9 100644
--- a/components/account/AccountSwitcher.vue
+++ b/components/user/UserSwitcher.vue
@@ -1,10 +1,10 @@
@@ -15,16 +15,16 @@ const sortedAccounts = computed(() => {
Switch Account
-
+
-
+
diff --git a/composables/client.ts b/composables/client.ts
index be2c7ace..9e6dce21 100644
--- a/composables/client.ts
+++ b/composables/client.ts
@@ -1,5 +1,5 @@
import { login } from 'masto'
-import { currentUser } from './accounts'
+import { currentUser } from './users'
import { DEFAULT_SERVER } from '~/constants'
// TODO: improve upsteam to make this synchronous (delayed auth)
diff --git a/composables/dialog.ts b/composables/dialog.ts
index 86526c17..de7afc8d 100644
--- a/composables/dialog.ts
+++ b/composables/dialog.ts
@@ -1,11 +1,11 @@
-export const isAccountSwitcherOpen = ref(false)
+export const isUserSwitcherOpen = ref(false)
export const isSigninDialogOpen = ref(false)
-export function openAccountSwitcher() {
- isAccountSwitcherOpen.value = true
+export function openUserSwitcher() {
+ isUserSwitcherOpen.value = true
}
export function openSigninDialog() {
isSigninDialogOpen.value = true
- isAccountSwitcherOpen.value = false
+ isUserSwitcherOpen.value = false
}
diff --git a/composables/accounts.ts b/composables/users.ts
similarity index 56%
rename from composables/accounts.ts
rename to composables/users.ts
index 79cd41a0..4318aa8c 100644
--- a/composables/accounts.ts
+++ b/composables/users.ts
@@ -2,30 +2,30 @@ import { login as loginMasto } from 'masto'
import type { UserLogin } from '~/types'
import { DEFAULT_SERVER } from '~/constants'
-const accounts = useLocalStorage('nuxtodon-accounts', [], { deep: true })
-const currentId = useLocalStorage('nuxtodon-current-user', '')
+const users = useLocalStorage('nuxtodon-accounts', [], { deep: true })
+const currentUserId = useLocalStorage('nuxtodon-current-user', '')
export const currentUser = computed(() => {
let user: UserLogin | undefined
- if (currentId.value) {
- user = accounts.value.find(user => user.account?.id === currentId.value)
+ if (currentUserId.value) {
+ user = users.value.find(user => user.account?.id === currentUserId.value)
if (user)
return user
}
// Fallback to the first account
- return accounts.value[0]
+ return users.value[0]
})
export const currentServer = computed(() => currentUser.value?.server || DEFAULT_SERVER)
-export const useAccounts = () => accounts
+export const useUsers = () => users
export async function loginTo(user: UserLogin) {
- const existing = accounts.value.findIndex(u => u.server === user.server && u.token === user.token)
+ const existing = users.value.findIndex(u => u.server === user.server && u.token === user.token)
if (existing !== -1) {
- if (currentId.value === accounts.value[existing].account?.id)
+ if (currentUserId.value === users.value[existing].account?.id)
return null
- currentId.value = user.account?.id
+ currentUserId.value = user.account?.id
await reloadPage()
return true
}
@@ -37,8 +37,8 @@ export async function loginTo(user: UserLogin) {
const me = await masto.accounts.verifyCredentials()
user.account = me
- accounts.value.push(user)
- currentId.value = me.id
+ users.value.push(user)
+ currentUserId.value = me.id
await reloadPage()
return true
}
@@ -48,12 +48,12 @@ export async function signout() {
if (!currentUser.value)
return
- const index = accounts.value.findIndex(u => u.account?.id === currentUser.value?.account?.id)
+ const index = users.value.findIndex(u => u.account?.id === currentUser.value?.account?.id)
if (index === -1)
return
- accounts.value.splice(index, 1)
- currentId.value = accounts.value[0]?.account?.id
+ users.value.splice(index, 1)
+ currentUserId.value = users.value[0]?.account?.id
await reloadPage()
}
diff --git a/layouts/default.vue b/layouts/default.vue
index 5d862048..64a1a74a 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -7,14 +7,14 @@
-
+
diff --git a/pages/@[user]/following.vue b/pages/@[user]/following.vue
index a3369cb1..c6a17063 100644
--- a/pages/@[user]/following.vue
+++ b/pages/@[user]/following.vue
@@ -1,8 +1,4 @@
-
-
-
-