Methods
# async createBlock()
Retrieves the list of blocks within a specific hospital.
# async createRole()
Creates a new role within a specific hospital.
# async createShift()
Creates a new shift within a specific hospital.
# async createUser()
Creates a new user within a specific hospital.
# async deleteWard()
Updates an existing ward's details within a specific hospital.
# async getDashboardMemos()
Retrieves memos for the dashboard view, optionally filtered by query parameters.
# async getHospital(hospitalId) → {Promise.<object>}
Retrieves details for a specific hospital by its ID. Typically called after a user logs in to get details about their assigned hospital.
Parameters:
Name | Type | Description |
---|---|---|
hospitalId |
string
|
number
|
The ID of the hospital. |
- The hospital details.
Promise.<object>
# async getUsers(hospitalId) → {Promise.<Array.<object>>}
Retrieves the list of users belonging to a specific hospital.
Parameters:
Name | Type | Description |
---|---|---|
hospitalId |
string
|
number
|
The ID of the hospital. |
- An array of user objects.
Promise.<Array.<object>>
# async login(phoneNumber, password, fcmTokenopt) → {Promise.<object>}
Authenticates a user and retrieves an authentication token.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
phoneNumber |
string
|
The user's phone number. |
||
password |
string
|
The user's password. |
||
fcmToken |
string
|
null
|
<optional> |
null | The FCM token for push notifications. |
- The authentication data, including the token.
Promise.<object>
# async logout() → {Promise.<null>}
Logs out the current user.
- A promise that resolves when the logout request is successful.
Promise.<null>
# async request(endpoint, optionsopt) → {Promise.<(object|null)>}
General request method to interact with the API. Automatically adds Authorization header if a token exists in localStorage.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
endpoint |
string
|
The API endpoint path. |
||
options |
object
|
<optional> |
{} | Fetch API options (method, headers, body, etc.). |
- If the HTTP response status is not OK or if the fetch fails.
Error
- The parsed JSON response or null for 204 No Content.
Promise.<(object|null)>
# async updateBlock()
Updates an existing block's details within a specific hospital.
# async updateUser()
Updates an existing user's details within a specific hospital.
# async updateWard()
Creates a new ward within a specific hospital.