initial implementation for password saving (#132)

* initial implementation for password saving

* support restoring password in interceptor

* Fix modal overflow and position styles

* warn about 429, better error handling

---------

Co-authored-by: jeffvli <jeffvictorli@gmail.com>
Co-authored-by: Jeff <42182408+jeffvli@users.noreply.github.com>
This commit is contained in:
Kendall Garner 2023-06-13 17:52:51 +00:00 committed by GitHub
parent a3a84766e4
commit 2fac9efc1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 310 additions and 62 deletions

View file

@ -31,6 +31,7 @@ import { ServerListItem, ServerType } from '/@/renderer/types';
import packageJson from '../../../../../package.json';
const browser = isElectron() ? window.electron.browser : null;
const localSettings = isElectron() ? window.electron.localSettings : null;
export const AppMenu = () => {
const navigate = useNavigate();
@ -45,11 +46,21 @@ export const AppMenu = () => {
setCurrentServer(server);
};
const handleCredentialsModal = (server: ServerListItem) => {
const handleCredentialsModal = async (server: ServerListItem) => {
let password: string | undefined;
try {
if (localSettings && server.savePassword) {
password = await localSettings.passwordGet(server.id);
}
} catch (error) {
console.error(error);
}
openModal({
children: server && (
<EditServerForm
isUpdate
password={password}
server={server}
onCancel={closeAllModals}
/>