-
-
Save gasserkl/8af98efd3a5c5d39d6f6cef14188b7c4 to your computer and use it in GitHub Desktop.
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
type LoginResponse = | |
| { loginSucceeded: true; username: string } | |
| { loginSucceeded: false; username?: never }; | |
export const loginUser = ( | |
username: string, | |
password: string | |
): Promise<LoginResponse> => { | |
return new Promise((resolve) => { | |
if (username === "admin" && password === "admin") { | |
resolve({ loginSucceeded: true, username: "admin" }); | |
} else { | |
resolve({ loginSucceeded: false }); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment