fix misc
All checks were successful
Build and push image for doorman-homeassistant / docker (push) Successful in 49s
Build and push Doorman UI / API / docker (push) Successful in 1m40s
Build and push image for doorman-homeassistant / deploy-gitainer (push) Successful in 5s

This commit is contained in:
Martin Dimitrov 2025-06-08 11:49:53 -07:00
parent 9c6932d050
commit 11827c30c1
2 changed files with 25 additions and 19 deletions

View File

@ -9,7 +9,7 @@ export async function getConfig(context: TwilioContext, buzzer: string): Promise
.then(res => res.json()) .then(res => res.json())
.catch(err => { .catch(err => {
return undefined; return undefined;
}); }) as InfoResponseClient;
} }
export async function notifyDiscord(context: TwilioContext, msg: string[], u: string[], optionalJsonStr: string[], metricsRegistry: Registry){ export async function notifyDiscord(context: TwilioContext, msg: string[], u: string[], optionalJsonStr: string[], metricsRegistry: Registry){

View File

@ -6,6 +6,7 @@ import { InputTokenGroup } from "../components/InputTokenGroup";
import { ReactNode, useState } from "react"; import { ReactNode, useState } from "react";
import CInput from "react-hook-form-cloudscape/components/input"; import CInput from "react-hook-form-cloudscape/components/input";
import CTextArea from "react-hook-form-cloudscape/components/textarea"; import CTextArea from "react-hook-form-cloudscape/components/textarea";
import { fetchUrlEncoded } from "../helpers/FetchHelper";
export type DoorEditForm = DoorResponse & { pin: string, fallbackNumber: string, discordUser: string, isConfirmed: boolean }; export type DoorEditForm = DoorResponse & { pin: string, fallbackNumber: string, discordUser: string, isConfirmed: boolean };
@ -107,25 +108,30 @@ export const EditPage = ({ isOnboarding }: EditPageProps) => {
timeout: parseInt("" + getValues("timeout")) timeout: parseInt("" + getValues("timeout"))
}; };
fetch(apiRoute + `?door=${door}&newConfig=${encodeURIComponent(JSON.stringify(form))}`) const body = {
.then(res => res.json()) door,
.then(res => { newConfig: JSON.stringify(form),
if (res.err) { };
addAlert("error", res.err);
return;
}
if (!isOnboarding) {
addAlert("success", `Created approval, check Discord notifcation from Doorman to confirm and approve the changes`);
} else if (res.redirect) {
// redirect for discord login
addAlert("in-progress", `Created Door, you will now be redirected to Discord login to complete the onboarding`);
// redirect in 2 seconds fetchUrlEncoded(apiRoute, body)
setTimeout(() => { .then(res => res.json())
window.location = res.redirect; .then(res => {
}, 2_000); if (res.err) {
} addAlert("error", res.err);
}) return;
}
if (!isOnboarding) {
addAlert("success", `Created approval, check Discord notifcation from Doorman to confirm and approve the changes`);
} else if (res.redirect) {
// redirect for discord login
addAlert("in-progress", `Created Door, you will now be redirected to Discord login to complete the onboarding`);
// redirect in 2 seconds
setTimeout(() => {
window.location = res.redirect;
}, 2_000);
}
});
}} }}
> >
Submit Submit