SYNC-HP用のサンプル
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 2 години
преди 2 години
преди 2 години
преди 2 години
преди 2 години
1234567891011121314
  1. import { Guitar } from "../type/guitars";
  2. /**
  3. * Guitar情報取得処理
  4. */
  5. export const fetchGuitars = async (): Promise<Guitar[]> => {
  6. // StrapiのAPIを呼び出し
  7. const response = await fetch(
  8. `${process.env.NEXT_PUBLIC_STRAPI_URL}/api/guitars?populate=*`
  9. );
  10. // apiのresponseからdata部のみ取り出し
  11. const guitars: Guitar[] = await response.json().then((json) => json.data);
  12. return guitars;
  13. };