mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-23 22:02:19 +00:00
fix: warn when 0 keys imported (#38)
This commit is contained in:
parent
48b8932a1d
commit
455a05c360
@ -49,8 +49,14 @@ export function PanelKWMv2Key() {
|
||||
const fileBuffer = await file.arrayBuffer();
|
||||
keys = MMKVParser.parseKuwoEKey(new DataView(fileBuffer));
|
||||
}
|
||||
|
||||
if (keys) {
|
||||
if (keys?.length === 0) {
|
||||
toast({
|
||||
title: '未导入密钥',
|
||||
description: '选择的密钥数据库文件未发现任何可用的密钥。',
|
||||
isClosable: true,
|
||||
status: 'warning',
|
||||
});
|
||||
} else if (keys) {
|
||||
dispatch(kwm2ImportKeys(keys));
|
||||
setShowImportModal(false);
|
||||
toast({
|
||||
|
@ -71,14 +71,20 @@ export function PanelQMCv2Key() {
|
||||
qmc2Keys = Array.from(map.entries(), ([name, ekey]) => ({ name: getFileName(name), ekey }));
|
||||
}
|
||||
|
||||
if (qmc2Keys) {
|
||||
if (qmc2Keys?.length === 0) {
|
||||
toast({
|
||||
title: '未导入密钥',
|
||||
description: '选择的密钥数据库文件未发现任何可用的密钥。',
|
||||
isClosable: true,
|
||||
status: 'warning',
|
||||
});
|
||||
} else if (qmc2Keys) {
|
||||
dispatch(qmc2ImportKeys(qmc2Keys));
|
||||
setShowImportModal(false);
|
||||
toast({
|
||||
title: `导入成功 (${qmc2Keys.length})`,
|
||||
description: '记得保存更改来应用。',
|
||||
isClosable: true,
|
||||
duration: 5000,
|
||||
status: 'success',
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user