Files
hackathon-opti-1a67c9077937…/frontend/src/services/feedback.service.ts
Diego Mireles 131eeacbd2 feat(frontend): register, guide, feedback, addresses & status polling
- Add register screen with onboarding redirect to address validation
- Add waste separation guide screen with 4 categories and offline tips
  (organicos, reciclables, sanitarios, especiales) plus preventive
  messaging banner
- Add feedback submission screen with 4 types and 1-5 star rating
- Add address screen: list colonias, pick one, validate against backend
- Switch from pull-to-refresh GPS hack to periodic polling of
  /tracking/status (30s) — backend now drives the simulation
- Filter notifications by logged-in user.id (tunnel-view on client side)
- Add register/logout/address actions to profile screen
- Hide login/register/feedback/addresses from tab bar (href: null)
- Set API_URL to LAN IP for physical phone testing over hotspot
2026-05-23 02:34:13 -06:00

32 lines
632 B
TypeScript

import { apiFetch } from "../lib/api";
export type FeedbackType =
| "TRUCK_DID_NOT_PASS"
| "RATING"
| "SUGGESTION"
| "OTHER";
export interface FeedbackPayload {
type: FeedbackType;
message: string;
rating?: number;
}
export interface FeedbackItem {
id: string;
userId: number;
type: FeedbackType;
message: string;
rating?: number;
createdAt: string;
}
export const submitFeedback = (payload: FeedbackPayload) =>
apiFetch<FeedbackItem>("/api/feedback", {
method: "POST",
body: JSON.stringify(payload),
});
export const listMyFeedback = () =>
apiFetch<FeedbackItem[]>("/api/feedback/me");