diff --git a/frontend/src/Components/LoginCheck.tsx b/frontend/src/Components/LoginCheck.tsx new file mode 100644 index 0000000..ccf761d --- /dev/null +++ b/frontend/src/Components/LoginCheck.tsx @@ -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;