Skip to content

Commit

Permalink
feat(search): nouveau paramètre pour rechercher
Browse files Browse the repository at this point in the history
  • Loading branch information
raphckrman committed May 24, 2024
1 parent 6e015b2 commit 4b20f5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/api/establishmentSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Establishment } from "../parser/Establishment";
import { SEARCH_ETABLISHMENT } from "../utils/endpoints";
import { TurboselfFetcher } from "../utils/fetcher";

export const searchEstablishment = async (city: string, limit: number): Promise<Array<Establishment>> => {
const response = await TurboselfFetcher("https://api-rest-prod.incb.fr" + SEARCH_ETABLISHMENT(city, limit), {
export const searchEstablishment = async (city?: string, code?: number, limit?: number): Promise<Array<Establishment>> => {
const response = await TurboselfFetcher("https://api-rest-prod.incb.fr" + SEARCH_ETABLISHMENT(city, code, limit), {
method: "GET",
headers: {
"Content-Type": "application/json"
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export const LOGIN = () => "/api/v1/auth/login";
export const SEND_PASSWORD_RESET_REQUEST = (email: string) => `/api/v1/utilisateurs/password?email=${email}`;
export const CREATE_ACCOUNT = () => "/api/v1/creation-comptes";

export const SEARCH_ETABLISHMENT = (city: string, limit: number) => `/api/v1/etablissements?q=${city}&limit=${limit}`;
export const SEARCH_ETABLISHMENT = (city?: string, code?: number, limit?: number) => `/api/v1/etablissements?q=${city ?? ""}&code2p5=${code ?? ""}&limit=${limit ?? 10}`;
export const GET_ETABLISHMENT = (id: number) => `/api/v1/etablissements/etabId/${id}`;

export const GET_HOST = (id: number) => `/api/v1/hotes/${id}`;
Expand Down

0 comments on commit 4b20f5a

Please sign in to comment.