Skip to content

Instantly share code, notes, and snippets.

@oaugusto256
Last active October 1, 2021 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oaugusto256/9db0cf70bd4de86861e79cb5c4b5eaf2 to your computer and use it in GitHub Desktop.
Save oaugusto256/9db0cf70bd4de86861e79cb5c4b5eaf2 to your computer and use it in GitHub Desktop.
Mock HTTP requests at JavaScript
// Mock HTTP requests
import { users, departaments } from '../mock';
export const getUsers = async () => {
return new Promise(resolve => setTimeout(() => {
resolve(users);
}, 2000));
};
// https://dev.to/nordicbeaver/a-real-life-example-of-making-a-custom-promise-in-javascript-typesctipt-5d1n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment