mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-14 21:23:40 +01:00
16 lines
395 B
TypeScript
16 lines
395 B
TypeScript
import { useKeyValue } from './useKeyValue';
|
|
|
|
export function useResponseViewMode(requestId?: string): [string | undefined, () => void] {
|
|
const v = useKeyValue<string>({
|
|
namespace: 'app',
|
|
key: ['response_view_mode', requestId ?? 'n/a'],
|
|
defaultValue: 'pretty',
|
|
});
|
|
|
|
const toggle = () => {
|
|
v.set(v.value === 'pretty' ? 'raw' : 'pretty');
|
|
};
|
|
|
|
return [v.value, toggle];
|
|
}
|