fix null
This commit is contained in:
@@ -8,7 +8,7 @@ export interface Submit {
|
||||
language: string;
|
||||
languageVersion: string;
|
||||
sourceCode: string;
|
||||
contestId: number | null;
|
||||
contestId?: number;
|
||||
}
|
||||
|
||||
export interface Solution {
|
||||
@@ -30,8 +30,8 @@ export interface MissionSubmit {
|
||||
id: number;
|
||||
userId: number;
|
||||
solution: Solution;
|
||||
contestId: number | null;
|
||||
contestName: string | null;
|
||||
contestId?: number;
|
||||
contestName?: string;
|
||||
sourceType: string;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ interface SubmitState {
|
||||
submitsById: Record<number, MissionSubmit[]>; // ✅ добавлено
|
||||
currentSubmit?: Submit;
|
||||
status: 'idle' | 'loading' | 'successful' | 'failed';
|
||||
error: string | null;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
// Начальное состояние
|
||||
@@ -49,7 +49,7 @@ const initialState: SubmitState = {
|
||||
submitsById: {}, // ✅ инициализация
|
||||
currentSubmit: undefined,
|
||||
status: 'idle',
|
||||
error: null,
|
||||
error: undefined,
|
||||
};
|
||||
|
||||
// AsyncThunk: Отправка решения
|
||||
@@ -123,7 +123,7 @@ const submitSlice = createSlice({
|
||||
clearCurrentSubmit: (state) => {
|
||||
state.currentSubmit = undefined;
|
||||
state.status = 'idle';
|
||||
state.error = null;
|
||||
state.error = undefined;
|
||||
},
|
||||
clearSubmitsByMission: (state, action: PayloadAction<number>) => {
|
||||
delete state.submitsById[action.payload];
|
||||
@@ -133,7 +133,7 @@ const submitSlice = createSlice({
|
||||
// Отправка решения
|
||||
builder.addCase(submitMission.pending, (state) => {
|
||||
state.status = 'loading';
|
||||
state.error = null;
|
||||
state.error = undefined;
|
||||
});
|
||||
builder.addCase(
|
||||
submitMission.fulfilled,
|
||||
@@ -153,7 +153,7 @@ const submitSlice = createSlice({
|
||||
// Получить все свои отправки
|
||||
builder.addCase(fetchMySubmits.pending, (state) => {
|
||||
state.status = 'loading';
|
||||
state.error = null;
|
||||
state.error = undefined;
|
||||
});
|
||||
builder.addCase(
|
||||
fetchMySubmits.fulfilled,
|
||||
@@ -173,7 +173,7 @@ const submitSlice = createSlice({
|
||||
// Получить отправку по ID
|
||||
builder.addCase(fetchSubmitById.pending, (state) => {
|
||||
state.status = 'loading';
|
||||
state.error = null;
|
||||
state.error = undefined;
|
||||
});
|
||||
builder.addCase(
|
||||
fetchSubmitById.fulfilled,
|
||||
@@ -193,7 +193,7 @@ const submitSlice = createSlice({
|
||||
// ✅ Получить отправки по миссии
|
||||
builder.addCase(fetchMySubmitsByMission.pending, (state) => {
|
||||
state.status = 'loading';
|
||||
state.error = null;
|
||||
state.error = undefined;
|
||||
});
|
||||
builder.addCase(
|
||||
fetchMySubmitsByMission.fulfilled,
|
||||
|
||||
Reference in New Issue
Block a user