1.9.1 • Published 4 years ago

@chief-noob/restaurant-ts-sdk v1.9.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Restaurant API SDK for Typescript

Introduction

點菜通系統 API 串接套件,用於 Typescript 前端開發。

Usage

Create a useAPI hook in project, inject the API_URL and session.

// hooks/useAPI.ts

import useSession from './useSession';
import API_URL from '../config';
import useRestaurantAPI from '@chief-noob/restaurant-ts-sdk';

function useAPI() {
  const session = useSession();
  return useRestaurantAPI(API_URL, session);
}

export default useAPI;

In component, simply use this hook to access the API service.

function RestaurantScreen() {
  const API = useAPI();
  const [restaurant, setRestaurant] = useState<Restaurant>();
  
  useEffect(() => {
    refresh();
  }, []);

  async function refresh() {
      const l = await API.restaurant.getOne(restaurantID);
      setRestaurant(l);
  }
  
  return (
    <View>
    ...
    </View>
  );
}
1.9.1

4 years ago

1.9.0

4 years ago

1.8.12

4 years ago

1.8.13

4 years ago

1.8.14

4 years ago

1.8.15

4 years ago

1.8.11

4 years ago

1.8.9

4 years ago

1.8.10

4 years ago

1.8.8

4 years ago

1.8.7

4 years ago

1.8.6

4 years ago

1.8.5

4 years ago

1.8.4

4 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.9

4 years ago

1.7.8

4 years ago

1.7.7

4 years ago

1.6.4

4 years ago

1.7.2

4 years ago

1.6.3

4 years ago

1.7.1

4 years ago

1.6.2

4 years ago

1.7.0

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.7.36

4 years ago

1.6.9

4 years ago

1.6.8

4 years ago

1.7.6

4 years ago

1.6.7

4 years ago

1.7.5

4 years ago

1.6.6

4 years ago

1.7.4

4 years ago

1.6.5

4 years ago

1.5.9

4 years ago

1.5.8

4 years ago

1.5.7

4 years ago

1.5.5

4 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.9

4 years ago