mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-27 19:20:12 +02:00
chore: event on limit exceed (#9069)
This commit is contained in:
@@ -395,6 +395,14 @@ export async function fetchWithAuthHandling(
|
||||
if (!response.ok) {
|
||||
const data = await response.json();
|
||||
if (data?.errors) {
|
||||
if (data?.type && data?.type === 'ai_tutor_limit_exceeded') {
|
||||
window?.fireEvent?.({
|
||||
action: 'tutor_credit_limit',
|
||||
category: 'ai_tutor',
|
||||
label: 'Tutor Credit Limit Exceeded',
|
||||
});
|
||||
}
|
||||
|
||||
throw new FetchError(response.status, data.message);
|
||||
} else {
|
||||
throw new Error('An unexpected error occurred');
|
||||
|
@@ -86,6 +86,14 @@ export async function httpCall<ResponseType = AppResponse>(
|
||||
|
||||
if (!response.ok) {
|
||||
if (data.errors) {
|
||||
if (data?.type && data?.type === 'ai_tutor_limit_exceeded') {
|
||||
window?.fireEvent?.({
|
||||
action: 'tutor_credit_limit',
|
||||
category: 'ai_tutor',
|
||||
label: 'Tutor Credit Limit Exceeded',
|
||||
});
|
||||
}
|
||||
|
||||
throw new FetchError(response?.status, data.message);
|
||||
} else if (data.message) {
|
||||
throw new FetchError(response?.status, data.message);
|
||||
|
Reference in New Issue
Block a user