-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contentful provide a client via the contentful npm package and they provide some boilerplate code. This commit aims to mirror the client's interface (only one method at the moment, for Pride events) and return data from the mock server. https://github.com/contentful/contentful.js Add `browser: true` to eslintrc file, otherwise it complains that the `fetch` method in MockClient has not been defined. See eslint/eslint#4015
- Loading branch information
1 parent
2f3e4d1
commit 305f7db
Showing
3 changed files
with
22 additions
and
6 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
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,12 @@ | ||
const API_URL = "http://192.168.1.4:3000"; | ||
const SYS_ID_TO_URL_MAPPINGS = { | ||
123: "/events" | ||
}; | ||
|
||
export default class MockClient { | ||
static getEntries(contentTypes) { | ||
const contentTypeUrl = SYS_ID_TO_URL_MAPPINGS[contentTypes.content_type]; | ||
|
||
return fetch(API_URL + contentTypeUrl).then(response => response.json()); | ||
} | ||
} |