Verify provider failure preserves drafts and improve user feedback
This commit is contained in:
@@ -24,6 +24,7 @@ export async function requestOfferAssistant({url, body, readToken, isCurrent = (
|
||||
const response = await fetcher(url, {signal:controller.signal, method:'POST', headers:{'Content-Type':'application/json', Authorization:`Bearer ${token}`}, body:JSON.stringify(payload)});
|
||||
const data = await response.json().catch(() => { throw new Error('Sunucudan okunabilir JSON yanıtı alınamadı. Yeniden deneyin.'); });
|
||||
check();
|
||||
if (response.status === 503) throw new Error('AI hizmeti şu anda kullanılamıyor. Çalışmanız korundu; daha sonra yeniden deneyin. Sorun sürerse uygulama yöneticinize bildirin.');
|
||||
if (!response.ok || data?.success === false) throw new Error(typeof data?.error === 'string' ? data.error : `HTTP ${response.status}`);
|
||||
return validateOfferResponse(url, data);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user