@tec.pet/tecpet-sdk 0.0.195 → 0.0.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,10 +8,13 @@ class EmployeeService {
|
|
|
8
8
|
}
|
|
9
9
|
async getEmployeesByServiceCategory(filter, shopId) {
|
|
10
10
|
const response = await this.api.get(`/employee/list`, filter, shopId);
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// A API pode responder 200 carregando um corpo de erro (`{message}`) em vez da
|
|
12
|
+
// lista. Sem esta checagem o retorno virava `[]`, indistinguível de "loja sem
|
|
13
|
+
// funcionários" — e o chatbot exibia uma seleção vazia em vez de falhar.
|
|
14
|
+
if (!response || !Array.isArray(response.data)) {
|
|
15
|
+
throw new Error(`Invalid response from /employee/list: ${JSON.stringify(response)}`);
|
|
13
16
|
}
|
|
14
|
-
return
|
|
17
|
+
return response.data;
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
exports.EmployeeService = EmployeeService;
|