Fix screenshot img src URLs missing /ppt-tool basePath

master-decks page: deck thumbnail + layout screenshot
templates/[id] page: layout thumbnail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-03-20 18:12:39 +00:00
parent 910f58369c
commit 17d1a0573c
2 changed files with 5 additions and 4 deletions

View file

@ -2,6 +2,7 @@
import { useEffect, useState, useCallback, useRef, useMemo } from 'react';
import { useParams } from 'next/navigation';
import { apiUrl } from '@/lib/apiFetch';
import { useDispatch, useSelector } from 'react-redux';
import { AppDispatch, RootState } from '@/store/store';
import {
@ -404,7 +405,7 @@ function DeckCard({
</button>
{deck.thumbnail_path ? (
<img
src={`/api/v1/admin/master-decks/${deck.id}/screenshot/${deck.thumbnail_path.split('/').pop()}`}
src={apiUrl(`/api/v1/admin/master-decks/${deck.id}/screenshot/${deck.thumbnail_path.split('/').pop()}`)}
alt={deck.name}
className="w-16 h-10 object-cover rounded border flex-shrink-0 bg-white"
onError={(e) => {
@ -611,7 +612,7 @@ function DeckCard({
>
{screenshotFilename ? (
<img
src={`/api/v1/admin/master-decks/${deck.id}/screenshot/${screenshotFilename}`}
src={apiUrl(`/api/v1/admin/master-decks/${deck.id}/screenshot/${screenshotFilename}`)}
alt={(layout.layout_name as string) || `Layout ${originalIndex + 1}`}
className="w-full h-24 object-cover rounded mb-2 bg-white"
loading="lazy"

View file

@ -1,7 +1,7 @@
'use client';
import { useEffect, useState, useCallback } from 'react';
import { apiFetch } from '../../../../lib/apiFetch';
import { apiFetch, apiUrl } from '../../../../lib/apiFetch';
import { useParams } from 'next/navigation';
import Link from 'next/link';
import { Button } from '@/components/ui/button';
@ -152,7 +152,7 @@ export default function TemplateDetailPage() {
{layout.thumbnail_path ? (
<div className="aspect-video bg-gray-100 overflow-hidden">
<img
src={`/api/v1/admin/master-decks/${templateId}/screenshot/${layout.thumbnail_path.split('/').pop()}`}
src={apiUrl(`/api/v1/admin/master-decks/${templateId}/screenshot/${layout.thumbnail_path.split('/').pop()}`)}
alt={layout.layout_name}
className="w-full h-full object-cover"
onError={(e) => {