mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-03 20:09:20 -05:00
9 lines
332 B
TypeScript
9 lines
332 B
TypeScript
import { useLocalStorage } from 'react-use';
|
|
|
|
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];
|
|
}
|