From 34337cad4aadafd1a5cfe3e06e418c22b8ff89f9 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Fri, 19 Dec 2025 17:55:21 +0800 Subject: [PATCH] Updated pages --- src/pages/MainPage/Main.tsx | 70 ++++++++++++++++++++++++++---- src/pages/ProfilePage/Profile.sass | 4 +- src/pages/ProfilePage/Profile.tsx | 70 ++++++++++++++++-------------- 3 files changed, 101 insertions(+), 43 deletions(-) diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index e802dab..dcd0316 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -58,6 +58,8 @@ export default () => { const [configNewEncPassword, setConfigNewEncPassword] = createSignal('') const [configError, setConfigError] = createSignal('') + const [configNotification, setConfigNotification] = createSignal(false) + let bldgadditional = false const getListForApproval = async () => { @@ -322,8 +324,14 @@ export default () => { const checkCurrentPassword = async () => { const encCurrentPassword = await securePassword(configPassword()) if (encCurrentPassword === configEncPassword()) { - setConfigError('') - encryptNewPassword() + if (configNewPassword() === '') { + setConfigError('New Password not provided') + setConfigNewEncPassword('') + } else { + setConfigError('') + encryptNewPassword() + } + } else { setConfigError('Invalid Password') setConfigNewEncPassword('') @@ -335,7 +343,26 @@ export default () => { setConfigNewEncPassword(encNewPassword) } - const saveConfig = () => {} + const saveConfig = async () => { + if (configNewName() !== '') await saveNewName(configNewName()) + if (configNewPassword() !== '') await saveNewPassword(configNewEncPassword()) + + setConfigNotification(true) + } + + 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 logout = async () => { removeEmployee() @@ -359,7 +386,9 @@ export default () => { checkCurrentPassword() } - if (configNewEncPassword() !== '') { + if (configNewPassword() !== '') { + encryptNewPassword() + } else { encryptNewPassword() } }) @@ -742,17 +771,40 @@ export default () => { {configError()} +