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:
@@ -14,7 +14,7 @@
|
||||
'use server';
|
||||
|
||||
|
||||
import { isRedirectError } from 'next/dist/client/components/redirect';
|
||||
import { isNextRedirectError } from '@/lib/utils/redirect-error';
|
||||
import { revalidatePath } from 'next/cache';
|
||||
import { serverFetch } from '@/lib/api/fetch-wrapper';
|
||||
import type { BadDebtRecord, CollectionStatus } from './types';
|
||||
@@ -288,7 +288,7 @@ export async function getBadDebts(params?: {
|
||||
|
||||
return result.data.data.map(transformApiToFrontend);
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] getBadDebts error:', error);
|
||||
return [];
|
||||
}
|
||||
@@ -322,7 +322,7 @@ export async function getBadDebtById(id: string): Promise<BadDebtRecord | null>
|
||||
|
||||
return transformApiToFrontend(result.data);
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] getBadDebtById error:', error);
|
||||
return null;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ export async function getBadDebtSummary(): Promise<BadDebtSummaryApiData | null>
|
||||
|
||||
return result.data;
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] getBadDebtSummary error:', error);
|
||||
return null;
|
||||
}
|
||||
@@ -401,7 +401,7 @@ export async function createBadDebt(
|
||||
data: transformApiToFrontend(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] createBadDebt error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -450,7 +450,7 @@ export async function updateBadDebt(
|
||||
data: transformApiToFrontend(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] updateBadDebt error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -486,7 +486,7 @@ export async function deleteBadDebt(id: string): Promise<{ success: boolean; err
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] deleteBadDebt error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -525,7 +525,7 @@ export async function toggleBadDebt(id: string): Promise<{ success: boolean; dat
|
||||
data: transformApiToFrontend(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] toggleBadDebt error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -574,7 +574,7 @@ export async function addBadDebtMemo(
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] addBadDebtMemo error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -611,7 +611,7 @@ export async function deleteBadDebtMemo(
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[BadDebtActions] deleteBadDebtMemo error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
Reference in New Issue
Block a user