From ffb97d70b9e2c7fe7128a6f448530983c667b585 Mon Sep 17 00:00:00 2001 From: Muhammad Eko Date: Thu, 3 Oct 2024 14:50:01 +0700 Subject: [PATCH] done --- .env.development | 1 + .env.production | 1 + src/config/index.ts | 5 +++++ src/services/api.ts | 4 +++- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .env.development create mode 100644 .env.production create mode 100644 src/config/index.ts diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..abee85e --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +NEXT_PUBLIC_API_URL="http://localhost:8080" \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..d489dc3 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +NEXT_PUBLIC_API_URL="https://erp.julongindonesia.com:8443/api" \ No newline at end of file diff --git a/src/config/index.ts b/src/config/index.ts new file mode 100644 index 0000000..d9792e1 --- /dev/null +++ b/src/config/index.ts @@ -0,0 +1,5 @@ +export const config = { + api: { + baseApiUrl: process.env.NEXT_PUBLIC_API_URL as string, + } + }; \ No newline at end of file diff --git a/src/services/api.ts b/src/services/api.ts index 8e8b86b..8630b68 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -1,9 +1,11 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' import { AttendanceRange, AttendanceSummary, EmployeeSummary, FilterOptions, MonthlyAttendance, MonthlyEmployee, ResignationCategory, ResignationReason, ResignationType as ResignationType, ResignSummary, User } from './types' import { Response , Filter} from './types' +import { config } from '@/config'; + export const api = createApi({ - baseQuery: fetchBaseQuery({ baseUrl: 'http://localhost:8080' }), + baseQuery: fetchBaseQuery({ baseUrl: config.api.baseApiUrl }), endpoints: (builder) => ({ login: builder.mutation<{ user: User;