Merge remote-tracking branch 'origin/master'

This commit is contained in:
2026-02-06 16:47:09 +09:00
9 changed files with 104 additions and 207 deletions

View File

@@ -170,7 +170,7 @@ export function WorkOrderCreate() {
};
// 폼 제출
const handleSubmit = async () => {
const handleSubmit = async (): Promise<{ success: boolean; error?: string }> => {
// Validation 체크
const errors: ValidationErrors = {};
@@ -200,7 +200,7 @@ export function WorkOrderCreate() {
setValidationErrors(errors);
// 페이지 상단으로 스크롤
window.scrollTo({ top: 0, behavior: 'smooth' });
return;
return { success: false, error: '' };
}
// 에러 초기화
@@ -218,16 +218,15 @@ export function WorkOrderCreate() {
note: formData.note || undefined,
});
if (result.success) {
toast.success('작업지시 등록되었습니다.');
router.push('/production/work-orders');
} else {
toast.error(result.error || '작업지시 등록에 실패했습니다.');
if (!result.success) {
return { success: false, error: result.error || '작업지시 등록에 실패했습니다.' };
}
return { success: true };
} catch (error) {
if (isNextRedirectError(error)) throw error;
console.error('[WorkOrderCreate] handleSubmit error:', error);
toast.error('작업지시 등록 중 오류가 발생했습니다.');
const errorMessage = error instanceof Error ? error.message : '작업지시 등록 중 오류가 발생했습니다.';
return { success: false, error: errorMessage };
} finally {
setIsSubmitting(false);
}
@@ -518,9 +517,8 @@ export function WorkOrderCreate() {
mode="create"
isLoading={isLoadingProcesses}
onCancel={handleCancel}
onSubmit={async (_data: Record<string, unknown>) => {
await handleSubmit();
return { success: true };
onSubmit={async () => {
return await handleSubmit();
}}
renderForm={renderFormContent}
/>