From b53c8b99a00d6b5d70557c1bab02251b6969b649 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Fri, 2 Jan 2026 12:40:07 +0700 Subject: [PATCH 1/2] chore: refresh user session when user first enter the web --- src/components/helper/RequireAuth.tsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) 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.

-
From 045913d05fb8958abff064c4252515c026d5dc1c Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Fri, 2 Jan 2026 13:28:46 +0700 Subject: [PATCH 2/2] chore: lint --- .gitlab-ci.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f4b1587..e02ea8ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -138,20 +138,20 @@ build:dev: environment: name: development variables: - NEXT_PUBLIC_LTI_URL: "https://dev-lti-erp.mbugroup.id" - NEXT_PUBLIC_SSO_LOGIN_URL: "https://dev-auth-erp.mbugroup.id" - NEXT_PUBLIC_API_BASE_URL: "https://dev-api-lti.mbugroup.id/api" - NEXT_PUBLIC_CLIENT_ID: "Lumbung-Telur-Indonesia" + NEXT_PUBLIC_LTI_URL: 'https://dev-lti-erp.mbugroup.id' + NEXT_PUBLIC_SSO_LOGIN_URL: 'https://dev-auth-erp.mbugroup.id' + NEXT_PUBLIC_API_BASE_URL: 'https://dev-api-lti.mbugroup.id/api' + NEXT_PUBLIC_CLIENT_ID: 'Lumbung-Telur-Indonesia' deploy:dev: <<: *deploy_template - needs: ["build:dev"] + needs: ['build:dev'] rules: - if: '$CI_COMMIT_BRANCH == "development"' variables: - S3_BUCKET: "dev-lti-erp.mbugroup.id" - AWS_REGION: "ap-southeast-3" - CLOUDFRONT_DISTRIBUTION_ID: "E1Z8XTA8XF1GIV" + S3_BUCKET: 'dev-lti-erp.mbugroup.id' + AWS_REGION: 'ap-southeast-3' + CLOUDFRONT_DISTRIBUTION_ID: 'E1Z8XTA8XF1GIV' environment: name: development url: https://dev-lti-erp.mbugroup.id @@ -166,20 +166,20 @@ build:staging: environment: name: staging variables: - NEXT_PUBLIC_LTI_URL: "https://stg-lti-erp.mbugroup.id" - NEXT_PUBLIC_SSO_LOGIN_URL: "https://stg-auth-erp.mbugroup.id" - NEXT_PUBLIC_API_BASE_URL: "https://stg-api-lti.mbugroup.id/api" - NEXT_PUBLIC_CLIENT_ID: "Lumbung-Telur-Indonesia" + NEXT_PUBLIC_LTI_URL: 'https://stg-lti-erp.mbugroup.id' + NEXT_PUBLIC_SSO_LOGIN_URL: 'https://stg-auth-erp.mbugroup.id' + NEXT_PUBLIC_API_BASE_URL: 'https://stg-api-lti.mbugroup.id/api' + NEXT_PUBLIC_CLIENT_ID: 'Lumbung-Telur-Indonesia' deploy:staging: <<: *deploy_template - needs: ["build:staging"] + needs: ['build:staging'] rules: - if: '$CI_COMMIT_BRANCH == "staging"' variables: - S3_BUCKET: "stg-lti-erp.mbugroup.id" - AWS_REGION: "ap-southeast-3" - CLOUDFRONT_DISTRIBUTION_ID: "E2V6PPO1AUIU7H" + S3_BUCKET: 'stg-lti-erp.mbugroup.id' + AWS_REGION: 'ap-southeast-3' + CLOUDFRONT_DISTRIBUTION_ID: 'E2V6PPO1AUIU7H' environment: name: staging - url: https://stg-lti-erp.mbugroup.id \ No newline at end of file + url: https://stg-lti-erp.mbugroup.id