enhance(frontend): 外部アプリ認証画面の改良 (misskey-dev#14828)

Cherry-picked from 076cc953e2bcd9f7335e2d9799cdf902829816cb

Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
あわわわとーにゅ 2024-11-06 08:23:28 +09:00
parent 62e801bf3a
commit d4bbae8d45
No known key found for this signature in database
GPG key ID: 6AFBBF529601C1DB
14 changed files with 964 additions and 226 deletions

View file

@ -19,13 +19,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { defineAsyncComponent, ref, computed } from 'vue';
import { ref, computed } from 'vue';
import type * as Misskey from 'misskey-js';
import FormSuspense from '@/components/form/suspense.vue';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { getAccounts, addAccount as addAccounts, removeAccount as _removeAccount, login, $i } from '@/account.js';
import { getAccounts, removeAccount as _removeAccount, login, $i, getAccountWithSigninDialog, getAccountWithSignupDialog } from '@/account.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
@ -74,22 +74,20 @@ async function removeAccount(account) {
}
function addExistingAccount() {
os.popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {}, {
done: async res => {
await addAccounts(res.id, res.i);
getAccountWithSigninDialog().then((res) => {
if (res != null) {
os.success();
init();
},
}, 'closed');
}
});
}
function createAccount() {
os.popup(defineAsyncComponent(() => import('@/components/MkSignupDialog.vue')), {}, {
done: async res => {
await addAccounts(res.id, res.i);
switchAccountWithToken(res.i);
},
}, 'closed');
getAccountWithSignupDialog().then((res) => {
if (res != null) {
switchAccountWithToken(res.token);
}
});
}
async function switchAccount(account: any) {