mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 08:59:07 +01:00
Always store response on filesystem
This commit is contained in:
@@ -2,16 +2,16 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import { readBinaryFile } from '@tauri-apps/api/fs';
|
||||
import type { HttpResponse } from '../lib/models';
|
||||
|
||||
export function useResponseBodyBlob(response: HttpResponse | null) {
|
||||
export function useResponseBodyBlob(response: HttpResponse) {
|
||||
return useQuery<Uint8Array | null>({
|
||||
enabled: response != null,
|
||||
queryKey: ['response-body-binary', response?.updatedAt],
|
||||
initialData: null,
|
||||
queryFn: async () => {
|
||||
if (response?.body) {
|
||||
if (response.body) {
|
||||
return Uint8Array.of(...response.body);
|
||||
}
|
||||
if (response?.bodyPath) {
|
||||
if (response.bodyPath) {
|
||||
return readBinaryFile(response.bodyPath);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user