Added list of registered names
This commit is contained in:
parent
a8d1c1fdf9
commit
3ed25c9cee
1 changed files with 21 additions and 19 deletions
|
|
@ -1,10 +1,11 @@
|
||||||
import './Index.sass'
|
import './Index.sass'
|
||||||
import { Button, Page, Padding, Display, Row, Logo, Column, Box } from '../../components'
|
import { Button, Page, Padding, Display, Row, Logo } from '../../components'
|
||||||
import { onMount } from 'solid-js'
|
import { onMount } from 'solid-js'
|
||||||
import { ofetch } from 'ofetch'
|
import { ofetch } from 'ofetch'
|
||||||
|
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
let assessorsNameList: string[]
|
let assessorsNameList: string[]
|
||||||
|
let registeredNameList: string[]
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const getAssessors = async () => {
|
const getAssessors = async () => {
|
||||||
|
|
@ -17,8 +18,27 @@ export default () => {
|
||||||
sessionStorage.setItem('assessors', JSON.stringify([...assessorsNameList]))
|
sessionStorage.setItem('assessors', JSON.stringify([...assessorsNameList]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getRegistered = async () => {
|
||||||
|
let nameList: string[] = []
|
||||||
|
|
||||||
|
try {
|
||||||
|
const registered = await ofetch(API + 'get-list-registered', { parseResponse: JSON.parse })
|
||||||
|
|
||||||
|
for (let i = 0; i < registered.result.length; i++) {
|
||||||
|
const name = await ofetch(API + 'get-employeename/' + registered.result[i], { parseResponse: JSON.parse })
|
||||||
|
nameList.push(name.result)
|
||||||
|
}
|
||||||
|
|
||||||
|
registeredNameList = [...nameList]
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
sessionStorage.setItem('registered', JSON.stringify([...registeredNameList]))
|
||||||
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await getAssessors()
|
await getAssessors()
|
||||||
|
await getRegistered()
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -38,24 +58,6 @@ export default () => {
|
||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Row>
|
||||||
</Display>
|
</Display>
|
||||||
|
|
||||||
<Display mobile>
|
|
||||||
<Column content="center">
|
|
||||||
<Logo size={120} />
|
|
||||||
<h1>OCBO e-Sign</h1>
|
|
||||||
|
|
||||||
<Button label="Register" edges="curved" to="/main" />
|
|
||||||
</Column>
|
|
||||||
</Display>
|
|
||||||
|
|
||||||
<Row content="spaced">
|
|
||||||
<Box thickness={1} curved>
|
|
||||||
<h2>Assessor</h2>
|
|
||||||
</Box>
|
|
||||||
<Box thickness={1} curved>
|
|
||||||
<h2>Approver</h2>
|
|
||||||
</Box>
|
|
||||||
</Row>
|
|
||||||
</Padding>
|
</Padding>
|
||||||
</Page>
|
</Page>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue