diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e02ea8ee..e80a7e02 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ stages: # ========================================================== default: tags: - - self-hosted + - server-development-biznet interruptible: true # ========================================================== diff --git a/src/components/helper/RequireAuth.tsx b/src/components/helper/RequireAuth.tsx index aa7f81b2..a4c9f5e0 100644 --- a/src/components/helper/RequireAuth.tsx +++ b/src/components/helper/RequireAuth.tsx @@ -29,8 +29,8 @@ const RequireAuth = ({ children }: RequireAuthProps) => { >('/sso/userinfo', httpClientFetcher, { shouldRetryOnError: false, - // refresh every 13 minutes - refreshInterval: 13 * 60 * 1000, + // refresh every 12 minutes + refreshInterval: 12 * 60 * 1000, }); useEffect(() => { @@ -61,12 +61,20 @@ const RequireAuth = ({ children }: RequireAuthProps) => { async () => { await AuthApi.refresh(); }, - 13 * 60 * 1000 + 12 * 60 * 1000 ); return () => clearInterval(interval); }, []); + useEffect(() => { + const refreshUserSession = async () => { + await AuthApi.refresh(); + }; + + refreshUserSession(); + }, []); + if ( (isLoadingUserResponse && !userResponse && !userErrorResponse) || (!userResponse && !userErrorResponse) @@ -78,7 +86,7 @@ const RequireAuth = ({ children }: RequireAuthProps) => { ); } - if (userErrorResponse) { + if (!isLoadingUserResponse && userErrorResponse) { return (

Authentication Failed

@@ -86,10 +94,7 @@ const RequireAuth = ({ children }: RequireAuthProps) => { Please try refreshing the page or contact support if the problem persists.

-
diff --git a/src/components/pages/report/production-result/ProductionResultContent.tsx b/src/components/pages/report/production-result/ProductionResultContent.tsx index 6fc8f7ea..ae6f744b 100644 --- a/src/components/pages/report/production-result/ProductionResultContent.tsx +++ b/src/components/pages/report/production-result/ProductionResultContent.tsx @@ -24,6 +24,7 @@ import { import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang'; import { isResponseError } from '@/lib/api-helper'; import Pagination from '@/components/Pagination'; +import { ProductionResultReportApi } from '@/services/api/report/production-result'; const ProductionResultContent = () => { const [projectFlockKandangs, setProjectFlockKandangs] = useState< @@ -145,8 +146,11 @@ const ProductionResultContent = () => { const exportToExcelHandler = async () => { setIsLoadingExportingToExcel(true); - // TODO: Implement export functionality in API service first if needed - toast.error('Fitur export belum tersedia'); + + await ProductionResultReportApi.exportProductionResultToExcel( + projectFlockKandangs + ); + setIsLoadingExportingToExcel(false); }; @@ -319,7 +323,13 @@ const ProductionResultContent = () => { align='end' direction='bottom' trigger={ -