fix : api url 수정
This commit is contained in:
@@ -104,7 +104,7 @@ export async function checkIn(
|
||||
data: CheckInRequest
|
||||
): Promise<{ success: boolean; data?: AttendanceRecord; error?: string; __authError?: boolean }> {
|
||||
try {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/attendances/check-in`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/attendances/check-in`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
user_id: data.userId,
|
||||
@@ -158,7 +158,7 @@ export async function checkOut(
|
||||
): Promise<{ success: boolean; data?: AttendanceRecord; error?: string }> {
|
||||
try {
|
||||
const headers = await getApiHeaders();
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/attendances/check-out`, {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/attendances/check-out`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify({
|
||||
@@ -218,7 +218,7 @@ export async function getTodayAttendance(): Promise<{
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
|
||||
const { response, error } = await serverFetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/v1/attendances?date=${today}&per_page=1`,
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/attendances?date=${today}&per_page=1`,
|
||||
{
|
||||
method: 'GET',
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ export async function getProcessList(params?: {
|
||||
if (params?.process_type) searchParams.set('process_type', params.process_type);
|
||||
|
||||
const { response, error } = await serverFetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/v1/processes?${searchParams.toString()}`,
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes?${searchParams.toString()}`,
|
||||
{ method: 'GET', cache: 'no-store' }
|
||||
);
|
||||
|
||||
@@ -177,7 +177,7 @@ export async function getProcessList(params?: {
|
||||
*/
|
||||
export async function getProcessById(id: string): Promise<{ success: boolean; data?: Process; error?: string; __authError?: boolean }> {
|
||||
try {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes/${id}`, {
|
||||
method: 'GET',
|
||||
cache: 'no-store',
|
||||
});
|
||||
@@ -210,7 +210,7 @@ export async function createProcess(data: ProcessFormData): Promise<{ success: b
|
||||
try {
|
||||
const apiData = transformFrontendToApi(data);
|
||||
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(apiData),
|
||||
});
|
||||
@@ -243,7 +243,7 @@ export async function updateProcess(id: string, data: ProcessFormData): Promise<
|
||||
try {
|
||||
const apiData = transformFrontendToApi(data);
|
||||
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes/${id}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(apiData),
|
||||
});
|
||||
@@ -274,7 +274,7 @@ export async function updateProcess(id: string, data: ProcessFormData): Promise<
|
||||
*/
|
||||
export async function deleteProcess(id: string): Promise<{ success: boolean; error?: string; __authError?: boolean }> {
|
||||
try {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
|
||||
@@ -304,7 +304,7 @@ export async function deleteProcess(id: string): Promise<{ success: boolean; err
|
||||
*/
|
||||
export async function deleteProcesses(ids: string[]): Promise<{ success: boolean; deletedCount?: number; error?: string; __authError?: boolean }> {
|
||||
try {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes`, {
|
||||
method: 'DELETE',
|
||||
body: JSON.stringify({ ids: ids.map((id) => parseInt(id, 10)) }),
|
||||
});
|
||||
@@ -335,7 +335,7 @@ export async function deleteProcesses(ids: string[]): Promise<{ success: boolean
|
||||
*/
|
||||
export async function toggleProcessActive(id: string): Promise<{ success: boolean; data?: Process; error?: string; __authError?: boolean }> {
|
||||
try {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}/toggle`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes/${id}/toggle`, {
|
||||
method: 'PATCH',
|
||||
});
|
||||
|
||||
@@ -370,7 +370,7 @@ export async function getProcessOptions(): Promise<{
|
||||
__authError?: boolean;
|
||||
}> {
|
||||
try {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/options`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes/options`, {
|
||||
method: 'GET',
|
||||
cache: 'no-store',
|
||||
});
|
||||
@@ -416,7 +416,7 @@ export async function getProcessStats(): Promise<{
|
||||
__authError?: boolean;
|
||||
}> {
|
||||
try {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/stats`, {
|
||||
const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/processes/stats`, {
|
||||
method: 'GET',
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user