Skip to content

Instantly share code, notes, and snippets.

Created November 3, 2019 12:26
What would you like to do?
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
// A fake authenticator to mock async api call
export async function apiLogin(name) {
await delay(2000);
if (name === "John") return true;
throw new Error("User not found!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment