fix appearance init

This commit is contained in:
Gregory Schier
2024-01-12 21:59:46 -08:00
parent a8630ede38
commit 93d1ff778e
4 changed files with 23 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
import { invoke } from '@tauri-apps/api';
import type { Environment, Folder, HttpRequest, Workspace } from './models';
import type { Environment, Folder, HttpRequest, Settings, Workspace } from './models';
export async function getSettings(): Promise<Settings> {
return invoke('get_settings', {});
}
export async function getRequest(id: string | null): Promise<HttpRequest | null> {
if (id === null) return null;

View File

@@ -4,10 +4,16 @@ import { attachConsole } from 'tauri-plugin-log-api';
import { App } from './components/App';
import { maybeRestorePathname } from './lib/persistPathname';
import './main.css';
import { getSettings } from './lib/store';
import type { Appearance } from './lib/theme/window';
import { setAppearanceOnDocument } from './lib/theme/window';
await attachConsole();
await maybeRestorePathname();
const settings = await getSettings();
setAppearanceOnDocument(settings.appearance as Appearance);
document.addEventListener('keydown', (e) => {
// Don't go back in history on backspace
if (e.key === 'Backspace') e.preventDefault();