refactor(client): Refine routing (#8846)

This commit is contained in:
syuilo 2022-06-20 17:38:49 +09:00 committed by GitHub
parent 30a39a296d
commit 699f24f3dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
149 changed files with 6312 additions and 6670 deletions

View file

@ -21,13 +21,13 @@
</template>
<script lang="ts" setup>
import { defineAsyncComponent, defineExpose, ref } from 'vue';
import { defineAsyncComponent, ref } from 'vue';
import FormSuspense from '@/components/form/suspense.vue';
import FormButton from '@/components/ui/button.vue';
import * as os from '@/os';
import * as symbols from '@/symbols';
import { getAccounts, addAccount as addAccounts, login, $i } from '@/account';
import { getAccounts, addAccount as addAccounts, removeAccount as _removeAccount, login, $i } from '@/account';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
const storedAccounts = ref<any>(null);
const accounts = ref<any>(null);
@ -39,7 +39,7 @@ const init = async () => {
console.log(storedAccounts.value);
return os.api('users/show', {
userIds: storedAccounts.value.map(x => x.id)
userIds: storedAccounts.value.map(x => x.id),
});
}).then(response => {
accounts.value = response;
@ -70,6 +70,10 @@ function addAccount(ev) {
}], ev.currentTarget ?? ev.target);
}
function removeAccount(account) {
_removeAccount(account.id);
}
function addExistingAccount() {
os.popup(defineAsyncComponent(() => import('@/components/signin-dialog.vue')), {}, {
done: res => {
@ -98,12 +102,14 @@ function switchAccountWithToken(token: string) {
login(token);
}
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.ts.accounts,
icon: 'fas fa-users',
bg: 'var(--bg)',
}
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
definePageMetadata({
title: i18n.ts.accounts,
icon: 'fas fa-users',
bg: 'var(--bg)',
});
</script>