change game du url from config.js file

This commit is contained in:
2025-11-21 15:24:11 +05:30
parent a975289aa7
commit e8b952b98b
31 changed files with 183 additions and 104 deletions

View File

@@ -50,7 +50,10 @@ import Layout from '../../layouts/Layout.astro';
</main>
</Layout>
<script src="/saveGameData.js" is:inline></script>
<script src="/config.js" is:inline></script>
<script is:inline>
let GAME_DU_URL_PREFIX = window.APP_CONFIG.PUBLIC_GAME_DU_API_URL;
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
const drawingZone = {
x: isMobile ? 0 : window.innerWidth / 4, // Set x to 0 on mobile, else 1/4 of screen width
@@ -132,7 +135,7 @@ import Layout from '../../layouts/Layout.astro';
var assetsList = {}
const params = new URLSearchParams(window.location.search);
const paramsID = params.get('id');
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/game_drag_v2/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
const data = fetch(`${GAME_DU_URL_PREFIX}/items/game_drag_v2/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
.then(response => response.json())
.then(({data}) => {
const {left_image1, left_image2, left_image3, left_image4, right_image1, right_image2, right_image3, right_image4} = data;
@@ -141,7 +144,7 @@ import Layout from '../../layouts/Layout.astro';
} else{
imageCustomWidth = "?width=100";
}
const assetsURL = "https://game-du.teachertrainingkolkata.in/assets/"
const assetsURL = `${GAME_DU_URL_PREFIX}/assets/`;
assetsList.left_image1 = assetsURL + left_image1 + imageCustomWidth;
assetsList.left_image2 = assetsURL + left_image2 + imageCustomWidth;
assetsList.left_image3 = assetsURL + left_image3 + imageCustomWidth;
@@ -277,7 +280,7 @@ import Layout from '../../layouts/Layout.astro';
create() {
const params = new URLSearchParams(window.location.search);
const paramsID = params.get('id');
fetch(`https://game-du.teachertrainingkolkata.in/items/game_drag_v2/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
fetch(`${GAME_DU_URL_PREFIX}/items/game_drag_v2/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
.then(response => response.json())
.then(({ data }) => {
// console.log(data) right_match