Updated main page
This commit is contained in:
parent
83a92ad3c1
commit
279e4e7bdc
2 changed files with 23 additions and 23 deletions
|
|
@ -95,7 +95,7 @@ h1
|
|||
&__button
|
||||
padding: 1rem 0 0 0
|
||||
|
||||
.required
|
||||
.required-config
|
||||
padding: 0.75rem 1rem
|
||||
border-radius: 8px
|
||||
background-color: color.adjust(#0D64E4, $blackness: 20%)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { FiLogOut } from 'solid-icons/fi'
|
|||
import { VsRefresh } from 'solid-icons/vs'
|
||||
import { createSignal, onMount, createEffect } from 'solid-js'
|
||||
import { Box, Button, Clickable, Column, Link, Logo, Modal, ModalButton, Padding, Page, Row, Input } from '../../components/'
|
||||
import { checkConnection, getApi, getApiMulti, postApi, securePassword } from '../../utils/functions'
|
||||
import { checkConnection, getApi, getApiMulti, postApi, saveNewName, saveNewPassword, securePassword } from '../../utils/functions'
|
||||
import { FaSolidUserGear } from 'solid-icons/fa'
|
||||
import { Show } from 'solid-js/web'
|
||||
import './Main.sass'
|
||||
|
|
@ -322,7 +322,7 @@ export default () => {
|
|||
}
|
||||
|
||||
const checkCurrentPassword = async () => {
|
||||
const encCurrentPassword = await securePassword(configPassword())
|
||||
const encCurrentPassword = await securePassword(configPassword(), 'v2')
|
||||
if (encCurrentPassword === configEncPassword()) {
|
||||
if (configNewPassword() === '') {
|
||||
setConfigError('New Password not provided')
|
||||
|
|
@ -339,39 +339,39 @@ export default () => {
|
|||
}
|
||||
|
||||
const encryptNewPassword = async () => {
|
||||
const encNewPassword = await securePassword(configNewPassword())
|
||||
const encNewPassword = await securePassword(configNewPassword(), 'v2')
|
||||
setConfigNewEncPassword(encNewPassword)
|
||||
}
|
||||
|
||||
const saveConfig = async () => {
|
||||
if (configNewName() !== '') await saveNewName(configNewName())
|
||||
if (configNewPassword() !== '') await saveNewPassword(configNewEncPassword())
|
||||
if (configNewName() !== '') await saveNewName(parseInt(ID), configNewName())
|
||||
if (configNewPassword() !== '') await saveNewPassword(parseInt(ID), configNewEncPassword())
|
||||
|
||||
setConfigNotification(true)
|
||||
}
|
||||
|
||||
const saveNewName = async (name: string) => {
|
||||
await postApi('update-name', {
|
||||
data: parseInt(ID),
|
||||
data2: name
|
||||
})
|
||||
}
|
||||
// const saveNewName = async (name: string) => {
|
||||
// await postApi('update-name', {
|
||||
// data: parseInt(ID),
|
||||
// data2: name
|
||||
// })
|
||||
// }
|
||||
|
||||
const saveNewPassword = async (password: string) => {
|
||||
await postApi('update-password', {
|
||||
data: parseInt(ID),
|
||||
data2: password
|
||||
})
|
||||
}
|
||||
// const saveNewPassword = async (password: string) => {
|
||||
// await postApi('update-password', {
|
||||
// data: parseInt(ID),
|
||||
// data2: password
|
||||
// })
|
||||
// }
|
||||
|
||||
const logout = async () => {
|
||||
removeEmployee()
|
||||
navigate('/')
|
||||
}
|
||||
|
||||
const gotoProfile = () => {
|
||||
navigate('/profile')
|
||||
}
|
||||
// const gotoProfile = () => {
|
||||
// navigate('/profile')
|
||||
// }
|
||||
|
||||
onMount(async () => {
|
||||
const logged = await checkLogged()
|
||||
|
|
@ -407,7 +407,7 @@ export default () => {
|
|||
|
||||
<Row content="left" gap={1.5}>
|
||||
<Box curved thickness={0} padding="1.25rem 2.25rem" background="#0f131d56">
|
||||
<span onClick={gotoProfile} class="name">{employeeName()}</span>
|
||||
<span class="name">{employeeName()}</span>
|
||||
</Box>
|
||||
<Clickable onClick={() => setOpenConfig(true)}>
|
||||
<Row gap={0.5}>
|
||||
|
|
@ -770,7 +770,7 @@ export default () => {
|
|||
</div>
|
||||
|
||||
<Show when={configError() !== ''}>
|
||||
<span class="required">{configError()}</span>
|
||||
<span class="required-config">{configError()}</span>
|
||||
<Button label='Cancel' edges='curved' design='bo-danger' onClick={() => setOpenConfig(false)} wide />
|
||||
</Show>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue