-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add authentication support - Rename types - Rename methods
- Loading branch information
Showing
17 changed files
with
269 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./types"; | ||
export * from "./methods"; | ||
export * from "./utils"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import axios from "axios"; | ||
import { API_URL } from "../utils"; | ||
import { IActivity, IEstablishment, IPaginateActivities } from "../types"; | ||
|
||
interface IActiviteOptions { | ||
/** A page number within the paginated result set. */ | ||
page?: number; | ||
/** Name of the town (ex. Bordeaux) */ | ||
commune?: string; | ||
} | ||
|
||
/** Lists the activities of establishments. */ | ||
export async function getActivities(key: string, query: IActiviteOptions = {}) { | ||
try { | ||
const r = await axios.get<IPaginateActivities>(`${API_URL}/activites/`, { | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Api-Key ${key}`, | ||
}, | ||
params: query, | ||
}); | ||
return r.data; | ||
} catch (error) { | ||
return null; | ||
} | ||
} | ||
|
||
/** List the activities of an establishments. */ | ||
export async function readActivity(key: string, slug: IActivity["slug"]) { | ||
try { | ||
const r = await axios.get<IActivity>(`${API_URL}/activites/${slug}/`, { | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Api-Key ${key}`, | ||
}, | ||
}); | ||
return r.data; | ||
} catch (error) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./accessibilite"; | ||
export * from "./activite"; | ||
export * from "./erp"; | ||
export * from "./accessibility"; | ||
export * from "./activity"; | ||
export * from "./establishment"; |
Oops, something went wrong.