forked from FoundKeyGang/FoundKey
fix(client): fix duplicate token request dialog in plugin install (#8612)
This commit is contained in:
parent
9230334a31
commit
d075ead80a
1 changed files with 11 additions and 31 deletions
|
@ -78,37 +78,6 @@ async function install() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const token = permissions == null || permissions.length === 0 ? null : await new Promise((res, rej) => {
|
|
||||||
os.popup(import('@/components/token-generate-window.vue'), {
|
|
||||||
title: i18n.ts.tokenRequested,
|
|
||||||
information: i18n.ts.pluginTokenRequestedDescription,
|
|
||||||
initialName: name,
|
|
||||||
initialPermissions: permissions
|
|
||||||
}, {
|
|
||||||
done: async result => {
|
|
||||||
const { name, permissions } = result;
|
|
||||||
const { token } = await os.api('miauth/gen-token', {
|
|
||||||
session: null,
|
|
||||||
name: name,
|
|
||||||
permission: permissions,
|
|
||||||
});
|
|
||||||
|
|
||||||
res(token);
|
|
||||||
}
|
|
||||||
}, 'closed');
|
|
||||||
});
|
|
||||||
|
|
||||||
installPlugin({
|
|
||||||
id: uuid(),
|
|
||||||
meta: {
|
|
||||||
name, version, author, description, permissions, config
|
|
||||||
},
|
|
||||||
token,
|
|
||||||
ast: serialize(ast)
|
|
||||||
});
|
|
||||||
|
|
||||||
os.success();
|
|
||||||
|
|
||||||
const token = permissions == null || permissions.length === 0 ? null : await new Promise((res, rej) => {
|
const token = permissions == null || permissions.length === 0 ? null : await new Promise((res, rej) => {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/token-generate-window.vue')), {
|
os.popup(defineAsyncComponent(() => import('@/components/token-generate-window.vue')), {
|
||||||
title: i18n.ts.tokenRequested,
|
title: i18n.ts.tokenRequested,
|
||||||
|
@ -128,6 +97,17 @@ async function install() {
|
||||||
}, 'closed');
|
}, 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
installPlugin({
|
||||||
|
id: uuid(),
|
||||||
|
meta: {
|
||||||
|
name, version, author, description, permissions, config
|
||||||
|
},
|
||||||
|
token,
|
||||||
|
ast: serialize(ast)
|
||||||
|
});
|
||||||
|
|
||||||
|
os.success();
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
unisonReload();
|
unisonReload();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue