fix: jump to home after user login
This commit is contained in:
parent
20ed3ce738
commit
eec37470f9
@ -27,9 +27,9 @@ export const currentInstance = computed<null | Instance>(() => currentUserId.val
|
|||||||
export const characterLimit = computed(() => currentInstance.value?.configuration.statuses.maxCharacters ?? DEFAULT_POST_CHARS_LIMIT)
|
export const characterLimit = computed(() => currentInstance.value?.configuration.statuses.maxCharacters ?? DEFAULT_POST_CHARS_LIMIT)
|
||||||
|
|
||||||
export async function loginTo(user: UserLogin & { account?: AccountCredentials }) {
|
export async function loginTo(user: UserLogin & { account?: AccountCredentials }) {
|
||||||
const existing = users.value.findIndex(u => u.server === user.server && u.token === user.token)
|
const existing = users.value.find(u => u.server === user.server && u.token === user.token)
|
||||||
if (existing !== -1) {
|
if (existing) {
|
||||||
if (currentUserId.value === users.value[existing].account?.id)
|
if (currentUserId.value === existing.account?.id)
|
||||||
return null
|
return null
|
||||||
currentUserId.value = user.account?.id
|
currentUserId.value = user.account?.id
|
||||||
await reloadPage()
|
await reloadPage()
|
||||||
|
@ -3,10 +3,12 @@ definePageMeta({
|
|||||||
layout: 'none',
|
layout: 'none',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
const { query } = useRoute()
|
const { query } = useRoute()
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loginTo(query as any)
|
await loginTo(query as any)
|
||||||
|
router.push('/')
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user