fix misc
This commit is contained in:
parent
9c6932d050
commit
11827c30c1
@ -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){
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user