saveCatCamSettings function

Future<bool> saveCatCamSettings(
  1. Map<String, Object> update
)

Changes the values in update on the cat cam; JSON, as it takes no other body.

Implementation

Future<bool> saveCatCamSettings(Map<String, Object> update) async {
  try {
    final response = await web.window
        .fetch(
          '/settings'.toJS,
          web.RequestInit(
            method: 'POST',
            headers:
                <String, String>{'content-type': 'application/json'}.jsify()
                    as web.HeadersInit,
            body: jsonEncode(update).toJS,
          ),
        )
        .toDart;
    return response.ok;
  } on Object {
    return false;
  }
}