update work with marched files

This commit is contained in:
smanylov
2026-03-27 15:10:06 +07:00
parent 9128c0e298
commit aff0b7a080
6 changed files with 141 additions and 54 deletions
+20 -7
View File
@@ -261,8 +261,9 @@ export async function fetchViolationStatistic() {
interface complainBody {
previousText: string,
errorMessage: string | null,
success: boolean
violationID: string | null,
success: boolean,
errorMessage?: string | null
}
export async function createComplaint(
@@ -297,7 +298,7 @@ export async function createComplaint(
if (parsed?.message_code === 0) {
return {
errorMessage: violationId,
violationID: violationId,
previousText: text,
success: true
};
@@ -307,11 +308,24 @@ export async function createComplaint(
} else {
throw (`${response.status}`);
}
} catch (error) {
} catch (error: unknown) {
if (error && typeof error === 'object' && 'message_code' in error) {
const err = error as { message_code: number };
if (err.message_code === 2) {
return {
violationID: violationId,
previousText: text,
success: false,
errorMessage: 'the-complaint-has-not-been-registered'
}
}
}
return {
errorMessage: violationId,
violationID: violationId,
previousText: text,
success: false
success: false,
errorMessage: 'error-save'
}
}
}
@@ -359,7 +373,6 @@ export type MatchStatus = 'NEW' | 'SHOWED' | 'LEGAL_IN_WORK' | 'COMPLAINT_IN_WOR
export async function updateMatchStatus(id: number, status: MatchStatus) {
const token = await getSessionData('token');
console.log('updateMatchStatus');
try {
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {