forked from Tadrisino/MathApp_frontend
FeedbackBar: like/dislike/report under every quiz question and lesson
This commit is contained in:
@@ -121,6 +121,17 @@ export const api = {
|
||||
),
|
||||
},
|
||||
|
||||
/** لایک/دیسلایک و گزارشِ ایراد روی سوال و درس (۰ = پسگرفتنِ رأی). */
|
||||
feedback: {
|
||||
vote: (kind: 'question' | 'lesson', id: string, value: 1 | -1 | 0) =>
|
||||
http.post<{ value: number }>(`/${kind === 'question' ? 'questions' : 'lessons'}/${seg(id)}/vote`, { value }),
|
||||
report: (kind: 'question' | 'lesson', id: string, reason: string, note?: string) =>
|
||||
http.post<{ success: boolean; reportId: number; alreadyReported: boolean }>(
|
||||
`/${kind === 'question' ? 'questions' : 'lessons'}/${seg(id)}/report`,
|
||||
{ reason, ...(note ? { note } : {}) },
|
||||
),
|
||||
},
|
||||
|
||||
leaderboard: (period: T.LeaderboardPeriod) =>
|
||||
http.get<{ period: string; entries: T.LeaderboardEntry[] }>(`/leaderboard${q({ period })}`).then((r) => r.entries),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user