Component for checking login, to be replaced with proper fetching
This commit is contained in:
parent
217b7b4a22
commit
94f5d3f85b
1 changed files with 35 additions and 0 deletions
35
frontend/src/Components/LoginCheck.tsx
Normal file
35
frontend/src/Components/LoginCheck.tsx
Normal 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;
|
Loading…
Reference in a new issue