Skip to main content

Get Last Consultation

getLastConsultation

You can use the getLastConsultation method to get the ConsultationType data object of the last consultation done for the user.

Returns

  • Promise<ResponseType<ConsultationType[]>>: A promise that resolves with an array containing one consultation object of ConsultationType, or an empty array if there are no consultations yet.

Example

import { getLastConsultation } from 'react-web-altibbi';

const response = await getLastConsultation();

This is commonly used to poll for an in-progress consultation (e.g. every few seconds while the user waits in a waiting room screen) to detect when a doctor accepts the consultation.

Responses

Status 200

Success

[
{
"id": 123,
"user_id": 999999999,
"question": "I want to consult a doctor on ...",
"medium": "chat",
"status": "new"
}
]

Status 401

UnauthorizedHttpException represents an Unauthorized HTTP exception with status code 401.

{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials",
"code": "0",
"status": "401",
"type": "yii\\web\\UnauthorizedHttpException"
}