update work with marched files
This commit is contained in:
@@ -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`, {
|
||||
|
||||
Reference in New Issue
Block a user