diff --git a/src/pages/RegisterPage/Register.tsx b/src/pages/RegisterPage/Register.tsx
index 3d21825..e4d84d8 100644
--- a/src/pages/RegisterPage/Register.tsx
+++ b/src/pages/RegisterPage/Register.tsx
@@ -1,14 +1,49 @@
import './Register.sass'
-import { Logo, Link, Page, Row, Padding, Form, Combobox, Box, File } from '../../components'
+import { Logo, Link, Page, Row, Padding, Combobox, Box, File, Button, Modal, Column } from '../../components'
import { IoChevronBack } from 'solid-icons/io'
import { Show, createSignal } from 'solid-js'
+import { ofetch } from 'ofetch'
+import { SHA3 } from 'crypto-js'
export default () => {
+ const API = import.meta.env.VITE_BACKEND
const assessors = JSON.parse(sessionStorage.getItem('assessors')!)
const roles = ['ASSESSOR', 'APPROVER']
const [role, setRole] = createSignal('')
const [name, setName] = createSignal('')
+ const [id, setId] = createSignal(0)
+ const [signature, setSignature] = createSignal('')
+ const [saved, setSaved] = createSignal(false)
+
+ const getEmployeeId = async (val: string) => {
+ try {
+ setName(val)
+ const id = await ofetch(API + 'get-employeeid/' + val, { parseResponse: JSON.parse })
+ setId(id.result)
+ } catch {
+ setId(0)
+ }
+ }
+
+ const generateSignature = () => {
+ const hash = SHA3(id().toString())
+ setSignature(hash.toString())
+
+ try {
+ register()
+ setSaved(true)
+ } catch {
+ setSaved(false)
+ }
+ }
+
+ const register = async () => {
+ await ofetch(API + 'post-registration', {
+ method: 'POST',
+ body: { data: id(), data2: signature() },
+ })
+ }
return (
<>
@@ -36,27 +71,49 @@ export default () => {