This commit is contained in:
Muhammad Eko 2024-10-03 14:50:01 +07:00
parent 8ef2970c25
commit ffb97d70b9
4 changed files with 10 additions and 1 deletions

1
.env.development Normal file
View File

@ -0,0 +1 @@
NEXT_PUBLIC_API_URL="http://localhost:8080"

1
.env.production Normal file
View File

@ -0,0 +1 @@
NEXT_PUBLIC_API_URL="https://erp.julongindonesia.com:8443/api"

5
src/config/index.ts Normal file
View File

@ -0,0 +1,5 @@
export const config = {
api: {
baseApiUrl: process.env.NEXT_PUBLIC_API_URL as string,
}
};

View File

@ -1,9 +1,11 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' 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 { AttendanceRange, AttendanceSummary, EmployeeSummary, FilterOptions, MonthlyAttendance, MonthlyEmployee, ResignationCategory, ResignationReason, ResignationType as ResignationType, ResignSummary, User } from './types'
import { Response , Filter} from './types' import { Response , Filter} from './types'
import { config } from '@/config';
export const api = createApi({ export const api = createApi({
baseQuery: fetchBaseQuery({ baseUrl: 'http://localhost:8080' }), baseQuery: fetchBaseQuery({ baseUrl: config.api.baseApiUrl }),
endpoints: (builder) => ({ endpoints: (builder) => ({
login: builder.mutation<{ login: builder.mutation<{
user: User; user: User;