Created
February 11, 2021 21:37
-
-
Save bpesquet/43b11ff98a31c770a4d0c01321c10488 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export interface User { | |
mail: string; | |
password: string; | |
nickName: string; | |
} | |
class UserService { | |
users: Array<User> = [ | |
{ mail: "[email protected]", password: "test", nickName: "test" }, | |
{ mail: "[email protected]", password: "admin", nickName: "admin" }, | |
]; | |
authenticate(mail: string, password: string): User | null { | |
return ( | |
// Search for the first user matching login and password | |
this.users.find((u) => u.mail === mail && u.password === password) || null | |
); | |
} | |
} | |
export default new UserService(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment