This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
react-rest-request/examples/movies/src/endpoint.ts

26 lines
532 B
TypeScript
Raw Normal View History

2020-11-04 14:39:57 +03:00
import { Endpoint, Method } from 'react-rest-request';
export type Movie = Readonly<{
id: number;
title: string;
posterURL: string;
imdbId: string;
}>
export const MoviesEndpoint: Endpoint = {
method: Method.GET,
url: '/action-adventure',
};
export type MoviesResponse = Movie[];
export const MovieEndpoint: Endpoint<MovieParams> = {
method: Method.GET,
url: ({ id }) => `/action-adventure/${id}`,
};
export type MovieParams = Readonly<{ id: React.Key }>;
export type MovieResponse = Movie[];