Hearth Code
まず Ember か Moss を選び、公開中のテーマをその場で見て、そのまま使う場所へ入れられます。
方向
版
現在の選択
HearthCode Moss Dark
ドライなチャコール。
HearthCode Moss Dark
1// async data fetching with full type safety
2import { createContext, useContext } from 'react'
3
4interface ApiResponse<T> {
5 data: T
6 status: number
7 ok: boolean
8}
9
10async function request<T>(
11 url: string,
12 options?: RequestInit
13): Promise<ApiResponse<T>> {
14 const res = await fetch(url, options)
15 const data = await res.json() as T
16 return { data, status: res.status, ok: res.ok }
17}
18
19const BASE = 'https://api.vesper.dev'
20const TIMEOUT = 5_000
インストールするか、GitHub で追う
今使いたい場所へそのまま入れるか、GitHub でプロジェクトを追えます。