Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Handle error thrown in postConfigUpdateToAPI (#3299)

Tiffany513336bfaf43
diff --git a/web/utils/config-constants.tsx b/web/utils/config-constants.tsx
index c5f7a549c3..d9e89cf85f 100644
--- a/web/utils/config-constants.tsx
+++ b/web/utils/config-constants.tsx
@@ -54,15 +54,22 @@ const TEXTFIELD_TYPE_URL = 'url';
export async function postConfigUpdateToAPI(args: ApiPostArgs) {
const { apiPath, data, onSuccess, onError } = args;
- const result = await fetchData(`${SERVER_CONFIG_UPDATE_URL}${apiPath}`, {
- data,
- method: 'POST',
- auth: true,
- });
- if (result.success && onSuccess) {
- onSuccess(result.message);
- } else if (onError) {
- onError(result.message);
+ try {
+ const result = await fetchData(`${SERVER_CONFIG_UPDATE_URL}${apiPath}`, {
+ data,
+ method: 'POST',
+ auth: true,
+ });
+ if (result.success && onSuccess) {
+ onSuccess(result.message);
+ } else if (onError) {
+ onError(result.message);
+ }
+ }
+ catch (e) {
+ if (onError) {
+ onError(e.message);
+ }
}
}