mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 04:26:01 +00:00
21 lines
696 B
TypeScript
21 lines
696 B
TypeScript
import { get } from 'svelte/store';
|
|
import getElectron from './getElectron';
|
|
import { currentArchive, extensions, selectedWidget } from '../stores';
|
|
import { showSnackbarSuccess } from './snackbar';
|
|
import { apiCall } from './api';
|
|
|
|
export async function openArchiveFolder() {
|
|
const electron = getElectron();
|
|
const ext = get(extensions);
|
|
const filePaths = await electron.showOpenDialog({
|
|
properties: ['openDirectory'],
|
|
});
|
|
const linkedFolder = filePaths && filePaths[0];
|
|
if (!linkedFolder) return;
|
|
const resp = await apiCall('archive/create-link', { linkedFolder });
|
|
|
|
currentArchive.set(resp);
|
|
selectedWidget.set('archive');
|
|
showSnackbarSuccess(`Created link ${resp}`);
|
|
}
|