From b75c283e10b0f8aa326cbb1e559c266e803353f6 Mon Sep 17 00:00:00 2001 From: Rajnish Dargan Date: Thu, 7 Nov 2024 23:01:11 +0530 Subject: [PATCH] Issue #PS-2413 feat: Integration of V1 Content Player in Teachers app --- next.config.mjs | 19 +++++++++++++++++++ src/services/PlayerService.ts | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 6fdecce3..4ac7a4fb 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -11,6 +11,17 @@ const remotes = (isServer) => { }; }; +const PORTAL_BASE_URL = "https://sunbird-editor.tekdinext.com"; + +const routes = { + API: { + GENERAL: { + CONTENT_PREVIEW: "/content/preview/:path*", + CONTENT_PLUGINS: "/content-plugins/:path*" + } + } +}; + const nextConfig = { eslint: { // Disabling on production builds because we're running checks on PRs via GitHub Actions. @@ -66,6 +77,14 @@ const nextConfig = { source: '/app/telemetry', // Match telemetry route destination: `${process.env.WORKSPACE_BASE_URL}/api/telemetry`, // Redirect to telemetry proxy }, + { + source: routes.API.GENERAL.CONTENT_PREVIEW, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_PREVIEW}`, // Proxy to portal + }, + { + source: routes.API.GENERAL.CONTENT_PLUGINS, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_PLUGINS}`, // Proxy to portal + } ]; }, webpack: (config, { isServer }) => { diff --git a/src/services/PlayerService.ts b/src/services/PlayerService.ts index 03942f02..d39d6214 100644 --- a/src/services/PlayerService.ts +++ b/src/services/PlayerService.ts @@ -3,7 +3,7 @@ import axios from 'axios'; export const fetchContent = async (identifier: any) => { try { - const API_URL = `${process.env.NEXT_PUBLIC_WORKSPACE_BASE_URL}${URL_CONFIG.API.CONTENT_READ}${identifier}`; + const API_URL = `${URL_CONFIG.API.CONTENT_READ}${identifier}`; const FIELDS = URL_CONFIG.PARAMS.CONTENT_GET; const LICENSE_DETAILS = URL_CONFIG.PARAMS.LICENSE_DETAILS; const MODE = 'edit'; @@ -20,7 +20,7 @@ export const fetchContent = async (identifier: any) => { export const getHierarchy = async (identifier: any) => { try { - const API_URL = `${process.env.NEXT_PUBLIC_WORKSPACE_BASE_URL}${URL_CONFIG.API.HIERARCHY_API}${identifier}`; + const API_URL = `${URL_CONFIG.API.HIERARCHY_API}${identifier}`; const response = await axios.get(API_URL); console.log('response =====>', response); return response?.data?.result?.content || response?.data?.result;