switchWard method

Future<bool> switchWard(
  1. int newWardId
)

Switches the current ward for the authenticated user. newWardId The ID of the ward to switch to. Returns a Future<bool> which is true if the switch was successful, false otherwise.

Implementation

Future<bool> switchWard(int newWardId) async {
  try {
    await _makeRequest(
      '/api/switch-ward/',
      method: 'POST',
      body: {
        'ward_id': newWardId,
      },
    );
    return true;
  } catch (e) {
    return false;
  }
}