Component for checking login, to be replaced with proper fetching

This commit is contained in:
Peter KW 2024-03-17 10:35:48 +01:00
parent 217b7b4a22
commit 94f5d3f85b

View file

@ -0,0 +1,35 @@
import { NewUser } from "../Types/Users";
function LoginCheck(props: { username: string; password: string }): number {
//Example users for testing without backend, remove when using backend
const admin: NewUser = {
userName: "admin",
password: "123",
};
const pmanager: NewUser = {
userName: "pmanager",
password: "123",
};
const user: NewUser = {
userName: "user",
password: "123",
};
//TODO: Compare with db instead when finished
if (props.username === admin.userName && props.password === admin.password) {
return 1;
} else if (
props.username === pmanager.userName &&
props.password === pmanager.password
) {
return 2;
} else if (
props.username === user.userName &&
props.password === user.password
) {
return 3;
}
return 0;
}
export default LoginCheck;