diff --git a/web/src/components/ListingCard.vue b/web/src/components/ListingCard.vue index 2dbf3e7..1244224 100644 --- a/web/src/components/ListingCard.vue +++ b/web/src/components/ListingCard.vue @@ -128,6 +128,12 @@ >⚑ + + +
+ + + + + + diff --git a/web/src/composables/useTrustFeedback.ts b/web/src/composables/useTrustFeedback.ts new file mode 100644 index 0000000..66a0e77 --- /dev/null +++ b/web/src/composables/useTrustFeedback.ts @@ -0,0 +1,28 @@ +// web/src/composables/useTrustFeedback.ts +// MIT -- component layer; the API call routes to a BSL endpoint. +import { ref } from 'vue' + +export type FeedbackState = 'idle' | 'sending' | 'confirmed' | 'disputed' + +export function useTrustFeedback(sellerId: string) { + const state = ref('idle') + + async function submitFeedback(confirmed: boolean): Promise { + if (state.value !== 'idle') return + state.value = 'sending' + try { + await fetch('/api/community/signal', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ seller_id: sellerId, confirmed }), + }) + // Always confirm regardless of response -- fail-soft contract. + } catch { + // Network unreachable -- still confirm to the user. Signal is best-effort. + } finally { + state.value = confirmed ? 'confirmed' : 'disputed' + } + } + + return { state, submitFeedback } +}