File size: 808 Bytes
65d68f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { apiPost } from "@/lib/api/client";

/**
 * Bug reports and product feedback. The backend accepts these with or without
 * a signed-in user (beta students may report before logging in); apiPost adds
 * the auth token automatically when a session exists.
 */

export type SupportKind = "bug" | "feedback";

export type SupportSubmissionInput = {
  kind: SupportKind;
  message: string;
  category?: string | null;
  title?: string | null;
  rating?: number | null;
  page_url?: string | null;
};

export type SupportSubmissionResult = {
  id: string;
  kind: string;
  status: string;
  created_at: string;
};

export function submitSupport(
  input: SupportSubmissionInput,
): Promise<SupportSubmissionResult> {
  return apiPost<SupportSubmissionResult, SupportSubmissionInput>("/support", input);
}