Applied keyboard event

This commit is contained in:
Patrick Alvin Alcala 2025-10-06 15:59:16 +08:00
parent 3bbf9ccd8a
commit 721dce1622

View file

@ -6,6 +6,7 @@ import { ofetch } from 'ofetch'
import { SHA1, SHA3 } from 'crypto-js' import { SHA1, SHA3 } from 'crypto-js'
import { useNavigate } from '@solidjs/router' import { useNavigate } from '@solidjs/router'
import { checkConnection } from '../../utils/functions' import { checkConnection } from '../../utils/functions'
import { _employeeId, _employeeName } from '../../stores/employee'
export default () => { export default () => {
const API = import.meta.env.VITE_BACKEND const API = import.meta.env.VITE_BACKEND
@ -39,6 +40,8 @@ export default () => {
} }
if (dbpassword.result === hashPassword) { if (dbpassword.result === hashPassword) {
_employeeId.set(employeeid)
_employeeName.set(name())
setLoggedin(2) setLoggedin(2)
} else { } else {
setLoggedin(1) setLoggedin(1)
@ -84,7 +87,8 @@ export default () => {
<Padding top={2} left={0} right={0} bottom={0}> <Padding top={2} left={0} right={0} bottom={0}>
<Row> <Row>
<Box curved thickness={2} padding="2rem" color="#2f465cd7" background="#04040654"> <Box curved thickness={2} padding="2.25rem" color="#2f465cd7" background="#04040660">
{/* <section class="box"> */}
<Row> <Row>
<span class="box-title">Login</span> <span class="box-title">Login</span>
</Row> </Row>
@ -102,7 +106,13 @@ export default () => {
<span class="approver-name">{APPROVERNAME}</span> <span class="approver-name">{APPROVERNAME}</span>
</Show> </Show>
<h4>Password</h4> <h4>Password</h4>
<Input value={password()} onChange={setPassword}></Input> <Input
value={password()}
onChange={setPassword}
onKeyDown={(event: KeyboardEvent) => {
if (event.key === 'Enter') login()
}}
/>
<Padding top={2} left={0} right={0} bottom={0}> <Padding top={2} left={0} right={0} bottom={0}>
<Show when={password() && name()}> <Show when={password() && name()}>
@ -129,6 +139,7 @@ export default () => {
</Row> </Row>
</Show> </Show>
</Padding> </Padding>
{/* </section> */}
</Box> </Box>
</Row> </Row>
</Padding> </Padding>