Support binary responses!

This commit is contained in:
Gregory Schier
2023-04-13 18:48:40 -07:00
parent 29309500a6
commit f9f1ba9e24
25 changed files with 455 additions and 231 deletions

View File

@@ -1,11 +1,8 @@
import { useLocalStorage } from 'react-use';
export function useResponseViewMode(
requestId?: string,
): [string | undefined, (m: 'pretty' | 'raw') => void] {
const [value, setValue] = useLocalStorage<'pretty' | 'raw'>(
`response_view_mode::${requestId}`,
'pretty',
);
return [value, setValue];
const DEFAULT_VIEW_MODE = 'pretty';
export function useResponseViewMode(requestId?: string): [string, (m: 'pretty' | 'raw') => void] {
const [value, setValue] = useLocalStorage<'pretty' | 'raw'>(`response_view_mode::${requestId}`);
return [value ?? DEFAULT_VIEW_MODE, setValue];
}