mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 02:05:59 +08:00
Client App Fix Issue [Bug] 'export' button does not work #2884
[+] fix(exporter.tsx): add async keyword to download function [+] feat(exporter.tsx): add support for saving image file using window.__TAURI__ API [+] feat(global.d.ts): add types for window.__TAURI__ API methods [+] feat(locales): add translations for download success and failure messages [+] feat(sync.ts): add support for generating backup file name with date and time [+] fix(utils.ts): add async keyword to downloadAs function and add support for saving file using window.__TAURI__ API
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { getClientConfig } from "../config/client";
|
||||
import { Updater } from "../typing";
|
||||
import { ApiPath, STORAGE_KEY, StoreKey } from "../constant";
|
||||
import { createPersistStore } from "../utils/store";
|
||||
@@ -20,6 +21,7 @@ export interface WebDavConfig {
|
||||
password: string;
|
||||
}
|
||||
|
||||
const isApp = !!getClientConfig()?.isApp;
|
||||
export type SyncStore = GetStoreState<typeof useSyncStore>;
|
||||
|
||||
const DEFAULT_SYNC_STATE = {
|
||||
@@ -57,7 +59,11 @@ export const useSyncStore = createPersistStore(
|
||||
|
||||
export() {
|
||||
const state = getLocalAppState();
|
||||
const fileName = `Backup-${new Date().toLocaleString()}.json`;
|
||||
const datePart = isApp
|
||||
? `${new Date().toLocaleDateString().replace(/\//g, '_')} ${new Date().toLocaleTimeString().replace(/:/g, '_')}`
|
||||
: new Date().toLocaleString();
|
||||
|
||||
const fileName = `Backup-${datePart}.json`;
|
||||
downloadAs(JSON.stringify(state), fileName);
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user