# @chief-noob/restaurant-ts-sdk

> ## Introduction

Latest version **1.9.1** (published 2021-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chief-noob/restaurant-ts-sdk
pnpm add @chief-noob/restaurant-ts-sdk
yarn add @chief-noob/restaurant-ts-sdk
bun add @chief-noob/restaurant-ts-sdk
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.9.1 |
| Published | 2021-08-30 |
| First published | 2021-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 178.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Yuanlin |
| Maintainers | yuanlinlin |

## Links

- npm: https://www.npmjs.com/package/@chief-noob/restaurant-ts-sdk
- npm.io page: https://npm.io/package/@chief-noob/restaurant-ts-sdk

## Dependencies (5)

- [eslint](https://npm.io/package/eslint.md) ^7.21.0
- [typescript](https://npm.io/package/typescript.md) ^4.2.3
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.13.10
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^4.17.0
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^4.17.0

## Recent versions

- 1.9.1 (latest) — 2021-08-30
- 1.9.0 — 2021-07-24
- 1.8.15 — 2021-07-24
- 1.8.14 — 2021-07-24
- 1.8.13 — 2021-07-24
- 1.8.12 — 2021-07-23
- 1.8.11 — 2021-07-20
- 1.8.10 — 2021-07-18
- 1.8.9 — 2021-07-18
- 1.8.8 — 2021-07-16
- 1.8.7 — 2021-07-15
- 1.8.6 — 2021-07-13
- 1.8.5 — 2021-07-13
- 1.8.4 — 2021-07-11
- 1.8.3 — 2021-07-11
- … 33 more at https://npm.io/package/@chief-noob/restaurant-ts-sdk/versions

## README

# Restaurant API SDK for Typescript

## Introduction

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

## Usage

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

```typescript
// 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.

```tsx
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>
  );
}
```

---
_Source: https://npm.io/package/@chief-noob/restaurant-ts-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
