chore(WEB): actions.ts 에러 핸들링 및 CEO 대시보드 개선
- 전체 모듈 actions.ts redirect 에러 핸들링 추가 - CEODashboard DetailModal 추가 - MonthlyExpenseSection 개선 - fetch-wrapper redirect 에러 처리 - redirect-error 유틸 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
'use server';
|
||||
|
||||
|
||||
import { isRedirectError } from 'next/dist/client/components/redirect';
|
||||
import { isNextRedirectError } from '@/lib/utils/redirect-error';
|
||||
import { serverFetch } from '@/lib/api/fetch-wrapper';
|
||||
import type { DraftRecord, DocumentStatus, Approver } from './types';
|
||||
|
||||
@@ -227,7 +227,7 @@ export async function getDrafts(params?: {
|
||||
lastPage: result.data.last_page,
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[DraftBoxActions] getDrafts error:', error);
|
||||
return { data: [], total: 0, lastPage: 1 };
|
||||
}
|
||||
@@ -256,7 +256,7 @@ export async function getDraftsSummary(): Promise<DraftsSummary | null> {
|
||||
|
||||
return result.data;
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[DraftBoxActions] getDraftsSummary error:', error);
|
||||
return null;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ export async function getDraftById(id: string): Promise<DraftRecord | null> {
|
||||
|
||||
return transformApiToFrontend(result.data);
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[DraftBoxActions] getDraftById error:', error);
|
||||
return null;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ export async function deleteDraft(id: string): Promise<{ success: boolean; error
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[DraftBoxActions] deleteDraft error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -385,7 +385,7 @@ export async function submitDraft(id: string): Promise<{ success: boolean; error
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[DraftBoxActions] submitDraft error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -450,7 +450,7 @@ export async function cancelDraft(id: string): Promise<{ success: boolean; error
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[DraftBoxActions] cancelDraft error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
Reference in New Issue
Block a user