- create default values for starter fields

- add starter api urls
- try and add TS types for initial components and objects
- cleanup status indicator on layout header
- create custom textfield for config form editing
This commit is contained in:
gingervitis
2020-12-28 01:11:26 -08:00
committed by Gabe Kangas
parent f63fe9ea7b
commit f0e5bbae1f
9 changed files with 202 additions and 50 deletions

View File

@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { STATUS, fetchData, FETCH_INTERVAL, SERVER_CONFIG } from './apis';
import { UpdateArgs } from '../types/config-section';
export const initialServerConfigState = {
streamKey: '',
@ -63,11 +64,20 @@ const ServerStatusProvider = ({ children }) => {
}
};
const setConfigField = ({ fieldName, value }) => {
const updatedConfig = {
const setConfigField = ({ fieldName, value, path }: UpdateArgs) => {
const updatedConfig = path ?
{
...config,
[path]: {
...config[path],
[fieldName]: value,
},
} :
{
...config,
[fieldName]: value,
};
setConfig(updatedConfig);
}