Files
yaak/src-web/hooks/useContentTypeFromHeaders.ts
Gregory Schier f967820f12 Model and DB refactor (#61)
- [x] Move from `sqlx` to `rusqlite`
- [x] Generate TS types from Rust models
2024-08-05 07:58:20 -07:00

10 lines
315 B
TypeScript

import { useMemo } from 'react';
import type { HttpResponseHeader } from '@yaakapp/api';
export function useContentTypeFromHeaders(headers: HttpResponseHeader[] | null): string | null {
return useMemo(
() => headers?.find((h) => h.name.toLowerCase() === 'content-type')?.value ?? null,
[headers],
);
}