feat: real back-in-stock subscription for Notify Me (API + localStorage fallback)
notifyMe() just called toggleWishlist() - no actual subscription
mechanism existed. Now calls a new subscribeToRestock() API method
(POST /items/{id}/notify-me, not yet built server-side - see
BACKEND-API-REFERENCE.md §12.5) and falls back to a local-only record
in localStorage on failure, so the request isn't silently dropped
while the backend catches up.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -694,6 +694,17 @@ export class ApiService {
|
||||
return this.http.post<{ message: string }>(`${this.baseUrl}/purchase-email`, emailData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Back-in-stock subscription. No backend endpoint exists for this yet
|
||||
* (tracked in BACKEND-API-REFERENCE.md §12) - callers should fall back to
|
||||
* a local-only record (see CartService/UX facade patterns) when this 404s
|
||||
* or the request otherwise fails, rather than surfacing an error to the
|
||||
* shopper for something this minor.
|
||||
*/
|
||||
subscribeToRestock(itemID: number, contact: { telegramUserId: string | null; email?: string }): Observable<void> {
|
||||
return this.http.post<void>(`${this.baseUrl}/items/${itemID}/notify-me`, contact);
|
||||
}
|
||||
|
||||
getRandomItems(count: number = 5, categoryID?: number): Observable<Item[]> {
|
||||
let params = new HttpParams().set('count', count.toString());
|
||||
if (categoryID) {
|
||||
|
||||
Reference in New Issue
Block a user