fix the component of access token list not mounted (#31824) (#31868)

This commit is contained in:
sillyguodong 2024-08-20 00:56:17 +08:00 committed by GitHub
parent fe9a631939
commit 5d2afc6e4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 21 deletions

View file

@ -0,0 +1,20 @@
import {createApp} from 'vue';
export async function initScopedAccessTokenCategories() {
const el = document.querySelector('#scoped-access-token-selector');
if (!el) return;
const {default: ScopedAccessTokenSelector} = await import(/* webpackChunkName: "scoped-access-token-selector" */'../components/ScopedAccessTokenSelector.vue');
try {
const View = createApp(ScopedAccessTokenSelector, {
isAdmin: JSON.parse(el.getAttribute('data-is-admin')),
noAccessLabel: el.getAttribute('data-no-access-label'),
readLabel: el.getAttribute('data-read-label'),
writeLabel: el.getAttribute('data-write-label'),
});
View.mount(el);
} catch (err) {
console.error('ScopedAccessTokenSelector failed to load', err);
el.textContent = el.getAttribute('data-locale-component-failed-to-load');
}
}