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:
@@ -1,7 +1,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 { AccountInfo, TermsAgreement, MarketingConsent } from './types';
|
||||
|
||||
@@ -112,7 +112,7 @@ export async function getAccountInfo(): Promise<{
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[AccountInfoActions] getAccountInfo error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -162,7 +162,7 @@ export async function withdrawAccount(password: string): Promise<{
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[AccountInfoActions] withdrawAccount error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -212,7 +212,7 @@ export async function suspendTenant(): Promise<{
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[AccountInfoActions] suspendTenant error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -264,7 +264,7 @@ export async function updateAgreements(
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[AccountInfoActions] updateAgreements error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -382,7 +382,7 @@ export async function uploadProfileImage(formData: FormData): Promise<{
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[AccountInfoActions] uploadProfileImage error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -1,7 +1,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 { Account, AccountFormData, AccountStatus } from './types';
|
||||
import { BANK_LABELS } from './types';
|
||||
@@ -130,7 +130,7 @@ export async function getBankAccounts(params?: {
|
||||
};
|
||||
return { success: true, data: accounts, meta };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[getBankAccounts] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -173,7 +173,7 @@ export async function getBankAccount(id: number): Promise<{
|
||||
const account = transformApiToFrontend(result.data);
|
||||
return { success: true, data: account };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[getBankAccount] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -218,7 +218,7 @@ export async function createBankAccount(data: AccountFormData): Promise<{
|
||||
const account = transformApiToFrontend(result.data);
|
||||
return { success: true, data: account };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[createBankAccount] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -266,7 +266,7 @@ export async function updateBankAccount(
|
||||
const account = transformApiToFrontend(result.data);
|
||||
return { success: true, data: account };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[updateBankAccount] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -306,7 +306,7 @@ export async function deleteBankAccount(id: number): Promise<{
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[deleteBankAccount] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -348,7 +348,7 @@ export async function toggleBankAccountStatus(id: number): Promise<{
|
||||
const account = transformApiToFrontend(result.data);
|
||||
return { success: true, data: account };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[toggleBankAccountStatus] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -390,7 +390,7 @@ export async function setPrimaryBankAccount(id: number): Promise<{
|
||||
const account = transformApiToFrontend(result.data);
|
||||
return { success: true, data: account };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[setPrimaryBankAccount] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -421,7 +421,7 @@ export async function deleteBankAccounts(ids: number[]): Promise<{
|
||||
|
||||
return { success: true, deletedCount: successCount };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[deleteBankAccounts] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,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';
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
||||
@@ -112,7 +112,7 @@ export async function getAttendanceSetting(): Promise<ApiResponse<AttendanceSett
|
||||
data: transformFromApi(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('getAttendanceSetting error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -152,7 +152,7 @@ export async function updateAttendanceSetting(
|
||||
data: transformFromApi(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('updateAttendanceSetting error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -211,7 +211,7 @@ export async function getDepartments(): Promise<ApiResponse<Department[]>> {
|
||||
|
||||
return { success: true, data: departments };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('getDepartments error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -1,7 +1,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 { CompanyFormData } from './types';
|
||||
|
||||
@@ -76,7 +76,7 @@ export async function getCompanyInfo(): Promise<{
|
||||
|
||||
return { success: true, data: formData };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[getCompanyInfo] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -126,7 +126,7 @@ export async function updateCompanyInfo(
|
||||
const updatedData = transformApiToFrontend(result.data);
|
||||
return { success: true, data: updatedData };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[updateCompanyInfo] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -275,7 +275,7 @@ export async function uploadCompanyLogo(formData: FormData): Promise<{
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[uploadCompanyLogo] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,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 { LeavePolicySettings } from './types';
|
||||
|
||||
@@ -101,7 +101,7 @@ export async function getLeavePolicy(): Promise<{
|
||||
data: transformedData,
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[LeavePolicyActions] getLeavePolicy error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -158,7 +158,7 @@ export async function updateLeavePolicy(data: Partial<LeavePolicySettings>): Pro
|
||||
data: transformedData,
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[LeavePolicyActions] updateLeavePolicy error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -1,7 +1,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 { NotificationSettings } from './types';
|
||||
import { DEFAULT_NOTIFICATION_SETTINGS } from './types';
|
||||
@@ -54,7 +54,7 @@ export async function getNotificationSettings(): Promise<{
|
||||
data: transformApiToFrontend(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[NotificationActions] getNotificationSettings error:', error);
|
||||
return {
|
||||
success: true,
|
||||
@@ -104,7 +104,7 @@ export async function saveNotificationSettings(
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[NotificationActions] saveNotificationSettings error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -1,7 +1,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 { PaymentApiData, PaymentHistory } from './types';
|
||||
import { transformApiToFrontend } from './utils';
|
||||
@@ -87,7 +87,7 @@ export async function getPayments(params?: {
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PaymentActions] getPayments error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -236,7 +236,7 @@ export async function getPaymentStatement(id: string): Promise<{
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PaymentActions] getPaymentStatement error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -1,7 +1,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 { Role, RoleStats, PermissionMatrix, MenuTreeItem, ApiResponse, PaginatedResponse } from './types';
|
||||
@@ -45,7 +45,7 @@ export async function fetchRoles(params?: {
|
||||
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to fetch roles:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '역할 목록 조회 실패' };
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export async function fetchRole(id: number): Promise<ApiResponse<Role>> {
|
||||
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to fetch role:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '역할 조회 실패' };
|
||||
}
|
||||
@@ -111,7 +111,7 @@ export async function createRole(data: {
|
||||
revalidatePath('/settings/permissions');
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to create role:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '역할 생성 실패' };
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export async function updateRole(
|
||||
revalidatePath(`/settings/permissions/${id}`);
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to update role:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '역할 수정 실패' };
|
||||
}
|
||||
@@ -184,7 +184,7 @@ export async function deleteRole(id: number): Promise<ApiResponse<void>> {
|
||||
revalidatePath('/settings/permissions');
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to delete role:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '역할 삭제 실패' };
|
||||
}
|
||||
@@ -213,7 +213,7 @@ export async function fetchRoleStats(): Promise<ApiResponse<RoleStats>> {
|
||||
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to fetch role stats:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '역할 통계 조회 실패' };
|
||||
}
|
||||
@@ -242,7 +242,7 @@ export async function fetchActiveRoles(): Promise<ApiResponse<Role[]>> {
|
||||
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to fetch active roles:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '활성 역할 목록 조회 실패' };
|
||||
}
|
||||
@@ -276,7 +276,7 @@ export async function fetchPermissionMenus(): Promise<ApiResponse<{
|
||||
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to fetch permission menus:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '메뉴 트리 조회 실패' };
|
||||
}
|
||||
@@ -305,7 +305,7 @@ export async function fetchPermissionMatrix(roleId: number): Promise<ApiResponse
|
||||
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to fetch permission matrix:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '권한 매트릭스 조회 실패' };
|
||||
}
|
||||
@@ -348,7 +348,7 @@ export async function togglePermission(
|
||||
revalidatePath(`/settings/permissions/${roleId}`);
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to toggle permission:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '권한 토글 실패' };
|
||||
}
|
||||
@@ -380,7 +380,7 @@ export async function allowAllPermissions(roleId: number): Promise<ApiResponse<{
|
||||
revalidatePath(`/settings/permissions/${roleId}`);
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to allow all permissions:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '전체 허용 실패' };
|
||||
}
|
||||
@@ -412,7 +412,7 @@ export async function denyAllPermissions(roleId: number): Promise<ApiResponse<{
|
||||
revalidatePath(`/settings/permissions/${roleId}`);
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to deny all permissions:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '전체 거부 실패' };
|
||||
}
|
||||
@@ -444,7 +444,7 @@ export async function resetPermissions(roleId: number): Promise<ApiResponse<{ co
|
||||
revalidatePath(`/settings/permissions/${roleId}`);
|
||||
return { success: true, data: result.data };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('Failed to reset permissions:', error);
|
||||
return { success: false, error: error instanceof Error ? error.message : '권한 초기화 실패' };
|
||||
}
|
||||
|
||||
@@ -12,7 +12,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 { Popup, PopupFormData } from './types';
|
||||
import { transformApiToFrontend, transformFrontendToApi, type PopupApiData } from './utils';
|
||||
@@ -82,7 +82,7 @@ export async function getPopups(params?: {
|
||||
|
||||
return result.data.data.map(transformApiToFrontend);
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PopupActions] getPopups error:', error);
|
||||
return [];
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export async function getPopupById(id: string): Promise<Popup | null> {
|
||||
|
||||
return transformApiToFrontend(result.data);
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PopupActions] getPopupById error:', error);
|
||||
return null;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ export async function createPopup(
|
||||
data: transformApiToFrontend(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PopupActions] createPopup error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -233,7 +233,7 @@ export async function updatePopup(
|
||||
data: transformApiToFrontend(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PopupActions] updatePopup error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -281,7 +281,7 @@ export async function deletePopup(id: string): Promise<{ success: boolean; error
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PopupActions] deletePopup error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -307,7 +307,7 @@ export async function deletePopups(ids: string[]): Promise<{ success: boolean; e
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[PopupActions] deletePopups error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -1,7 +1,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 { Rank } from './types';
|
||||
|
||||
@@ -84,7 +84,7 @@ export async function getRanks(params?: {
|
||||
const ranks = result.data.map(transformApiToFrontend);
|
||||
return { success: true, data: ranks };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[getRanks] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -136,7 +136,7 @@ export async function createRank(data: {
|
||||
const rank = transformApiToFrontend(result.data);
|
||||
return { success: true, data: rank };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[createRank] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -186,7 +186,7 @@ export async function updateRank(
|
||||
const rank = transformApiToFrontend(result.data);
|
||||
return { success: true, data: rank };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[updateRank] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -226,7 +226,7 @@ export async function deleteRank(id: number): Promise<{
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[deleteRank] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -269,7 +269,7 @@ export async function reorderRanks(
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[reorderRanks] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,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 { SubscriptionApiData, UsageApiData, SubscriptionInfo } from './types';
|
||||
import { transformApiToFrontend } from './utils';
|
||||
@@ -54,7 +54,7 @@ export async function getCurrentSubscription(): Promise<{
|
||||
data: result.data,
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[SubscriptionActions] getCurrentSubscription error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -112,7 +112,7 @@ export async function getUsage(): Promise<{
|
||||
data: result.data,
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[SubscriptionActions] getUsage error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -166,7 +166,7 @@ export async function cancelSubscription(
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[SubscriptionActions] cancelSubscription error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -225,7 +225,7 @@ export async function requestDataExport(
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[SubscriptionActions] requestDataExport error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -264,7 +264,7 @@ export async function getSubscriptionData(): Promise<{
|
||||
data,
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[SubscriptionActions] getSubscriptionData error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -1,7 +1,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 { Title } from './types';
|
||||
|
||||
@@ -84,7 +84,7 @@ export async function getTitles(params?: {
|
||||
const titles = result.data.map(transformApiToFrontend);
|
||||
return { success: true, data: titles };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[getTitles] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -136,7 +136,7 @@ export async function createTitle(data: {
|
||||
const title = transformApiToFrontend(result.data);
|
||||
return { success: true, data: title };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[createTitle] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -186,7 +186,7 @@ export async function updateTitle(
|
||||
const title = transformApiToFrontend(result.data);
|
||||
return { success: true, data: title };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[updateTitle] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -226,7 +226,7 @@ export async function deleteTitle(id: number): Promise<{
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[deleteTitle] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
@@ -269,7 +269,7 @@ export async function reorderTitles(
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[reorderTitles] Error:', error);
|
||||
return { success: false, error: '서버 오류가 발생했습니다.' };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,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';
|
||||
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://sam.kr:8080';
|
||||
@@ -120,7 +120,7 @@ export async function getWorkSetting(): Promise<{
|
||||
data: transformFromApi(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('getWorkSetting error:', error);
|
||||
return {
|
||||
success: false,
|
||||
@@ -169,7 +169,7 @@ export async function updateWorkSetting(
|
||||
data: transformFromApi(result.data),
|
||||
};
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) throw error;
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('updateWorkSetting error:', error);
|
||||
return {
|
||||
success: false,
|
||||
|
||||
Reference in New Issue
Block a user