Skip to content

Commit

Permalink
Allow opening the app in a browser
Browse files Browse the repository at this point in the history
For development purposes it's convenient to be able to open the app in
Chrome. To do this we skip invoking internal Tauri commands.
  • Loading branch information
rudolfs authored and sebastinez committed Sep 5, 2024
1 parent b6711a5 commit 3d9e614
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
onMount(async () => {
try {
await invoke("authenticate");
// For development purposes don't run tauri commands when viewing from
// a browser.
if (window.__TAURI_INTERNALS__) {
await invoke("authenticate");
}
void router.push({ resource: "home" });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e: any) {
Expand Down
8 changes: 8 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare global {
interface Window {
// eslint-disable-next-line @typescript-eslint/naming-convention
__TAURI_INTERNALS__: Record<string, unknown>;
}
}

export {};

0 comments on commit 3d9e614

Please sign in to comment.