mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
19 lines
613 B
TypeScript
19 lines
613 B
TypeScript
import { importUserApi } from '@/core/userApi'
|
|
import { readFile } from '@/utils/fs'
|
|
import { log } from '@/utils/log'
|
|
import { toast } from '@/utils/tools'
|
|
|
|
|
|
export const handleImport = (path: string) => {
|
|
// toast(global.i18n.t('setting_backup_part_import_list_tip_unzip'))
|
|
void readFile(path).then(async script => {
|
|
if (script == null) throw new Error('Read file failed')
|
|
await importUserApi(script)
|
|
toast(global.i18n.t('user_api_import_success_tip'))
|
|
}).catch((error: any) => {
|
|
log.error(error.stack)
|
|
toast(global.i18n.t('user_api_import_failed_tip') + '\n' + error.message)
|
|
})
|
|
}
|
|
|