fix invoke in stream.ts, upgrade package

This commit is contained in:
04041b 2024-12-11 21:49:19 -08:00
parent 3e090931d2
commit 58f103eaf6
5 changed files with 32 additions and 35 deletions

2
app/global.d.ts vendored
View File

@ -12,6 +12,7 @@ declare module "*.svg";
declare interface Window { declare interface Window {
__TAURI__?: { __TAURI__?: {
core: {
writeText(text: string): Promise<void>; writeText(text: string): Promise<void>;
invoke(command: string, payload?: Record<string, unknown>): Promise<any>; invoke(command: string, payload?: Record<string, unknown>): Promise<any>;
dialog: { dialog: {
@ -40,4 +41,5 @@ declare interface Window {
): Promise<Response<T>>; ): Promise<Response<T>>;
}; };
}; };
};
} }

View File

@ -74,7 +74,7 @@ export function fetch(url: string, options?: RequestInit): Promise<Response> {
for (const item of new Headers(_headers || {})) { for (const item of new Headers(_headers || {})) {
headers[item[0]] = item[1]; headers[item[0]] = item[1];
} }
return window.__TAURI__ return window.__TAURI__.core
.invoke("stream_fetch", { .invoke("stream_fetch", {
method: method.toUpperCase(), method: method.toUpperCase(),
url, url,

View File

@ -64,7 +64,7 @@
"zustand": "^4.3.8" "zustand": "^4.3.8"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/api": "2.0.0", "@tauri-apps/api": "^2.1.1",
"@tauri-apps/cli": "^2.1.0", "@tauri-apps/cli": "^2.1.0",
"@testing-library/dom": "^10.4.0", "@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3", "@testing-library/jest-dom": "^6.6.3",

File diff suppressed because one or more lines are too long

View File

@ -2029,12 +2029,7 @@
dependencies: dependencies:
tslib "^2.4.0" tslib "^2.4.0"
"@tauri-apps/api@2.0.0": "@tauri-apps/api@^2.0.0", "@tauri-apps/api@^2.1.1":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-2.0.0.tgz#a75768a578958210827aca752c804118a6a76f11"
integrity sha512-moKgCp2EX7X5GiOx/G/bmoEpkFQVVmyS98UaJU4xUVzan+E1BdwlAKcbip+cGldshYOqL4JSwAEN1OkRXeug0Q==
"@tauri-apps/api@^2.0.0":
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-2.1.1.tgz#77d4ddb683d31072de4e6a47c8613d9db011652b" resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-2.1.1.tgz#77d4ddb683d31072de4e6a47c8613d9db011652b"
integrity sha512-fzUfFFKo4lknXGJq8qrCidkUcKcH2UHhfaaCNt4GzgzGaW2iS26uFOg4tS3H4P8D6ZEeUxtiD5z0nwFF0UN30A== integrity sha512-fzUfFFKo4lknXGJq8qrCidkUcKcH2UHhfaaCNt4GzgzGaW2iS26uFOg4tS3H4P8D6ZEeUxtiD5z0nwFF0UN30A==