Use optional parameters when possible

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2019-03-01 19:42:59 -08:00
parent 10d6570d50
commit ce177ba4ca
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ class EnableDisable extends Component<EnableDisableProps, EnableDisableState> {
* @param action The action to perform ("enable" or "disable")
* @param time The amount of time to disable for. This setting is optional.
*/
setStatus = (action: StatusAction, time: number | null = null) => {
setStatus = (action: StatusAction, time?: number) => {
if (this.state.processing) {
// Wait for the first status change to go through
return;
+2 -2
View File
@@ -70,7 +70,7 @@ export class WithAPIData<T> extends Component<
private dataHandle: CancelablePromise<T> | undefined;
loadData = (data: T | null = null) => {
loadData = (data?: T) => {
// Only repeat if there is a non-zero repeat interval
const cancelOptions =
this.props.repeatOptions.interval !== 0
@@ -85,7 +85,7 @@ export class WithAPIData<T> extends Component<
this.dataHandle.cancel();
}
if (data !== null) {
if (data) {
// Some data was given, it should be used as the API response
this.setState({ apiResult: new Ok(data) });
+1 -1
View File
@@ -84,7 +84,7 @@ export default {
getStatus(): Promise<ApiStatus> {
return http.get("dns/status");
},
setStatus(action: StatusAction, time: number | null = null) {
setStatus(action: StatusAction, time?: number) {
return http.post("dns/status", { action, time });
},
getNetworkInfo(): Promise<ApiNetworkSettings> {