- import { Guitar } from "../type/guitars";
-
- /**
- * Guitar情報取得処理
- */
- export const fetchGuitars = async (): Promise<Guitar[]> => {
- // StrapiのAPIを呼び出し
- const response = await fetch(
- `${process.env.NEXT_PUBLIC_STRAPI_URL}/api/guitars?populate=*`
- );
- // apiのresponseからdata部のみ取り出し
- const guitars: Guitar[] = await response.json().then((json) => json.data);
- return guitars;
- };
|