Refactor API response handling in test submission feature to align with server response structure; update ChainsListPage to use 'disabled' prop for button state instead of 'isDisabled', enhancing code clarity and consistency.
This commit is contained in:
@@ -15,7 +15,6 @@ import type {
|
|||||||
UpdateChainRequest,
|
UpdateChainRequest,
|
||||||
SubmitRequest,
|
SubmitRequest,
|
||||||
TestSubmissionResult,
|
TestSubmissionResult,
|
||||||
APIResponse,
|
|
||||||
} from '../../types/challenge'
|
} from '../../types/challenge'
|
||||||
|
|
||||||
export const api = createApi({
|
export const api = createApi({
|
||||||
@@ -158,7 +157,8 @@ export const api = createApi({
|
|||||||
hiddenInstructions,
|
hiddenInstructions,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
transformResponse: (response: APIResponse<TestSubmissionResult>) => response.data,
|
// Сервер возвращает { success: boolean; body: TestSubmissionResult }
|
||||||
|
transformResponse: (response: { success: boolean; body: TestSubmissionResult }) => response.body,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ export const ChainsListPage: React.FC = () => {
|
|||||||
size="xs"
|
size="xs"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => handleToggleActive(chain, !chain.isActive)}
|
onClick={() => handleToggleActive(chain, !chain.isActive)}
|
||||||
isDisabled={updatingChainId === chain.id}
|
disabled={updatingChainId === chain.id}
|
||||||
>
|
>
|
||||||
{chain.isActive
|
{chain.isActive
|
||||||
? t('challenge.admin.chains.list.status.inactive')
|
? t('challenge.admin.chains.list.status.inactive')
|
||||||
|
|||||||
Reference in New Issue
Block a user