feat: add sign-in flow, routing shell, and searchable book list
Pin @testing-library/jest-dom to ~6.9.1 (6.10.0 is npm-deprecated). Claude-Session: https://claude.ai/code/session_01M9MLit5Ko3X4s7rzC5Kv7X
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { api, errorMessage, type Genre } from '../api'
|
||||
|
||||
export function useGenres(): { genres: Genre[]; error: string | null } {
|
||||
const [genres, setGenres] = useState<Genre[]>([])
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
useEffect(() => {
|
||||
api<Genre[]>('GET', '/genres').then(setGenres, (err) => setError(errorMessage(err)))
|
||||
}, [])
|
||||
return { genres, error }
|
||||
}
|
||||
Reference in New Issue
Block a user