Skip to content

Commit

Permalink
feat: allow forced tags to allow using the frontend for other pages
Browse files Browse the repository at this point in the history
  • Loading branch information
TheChristophe committed Jan 12, 2024
1 parent 796b5f0 commit 75b956f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import OrderingSelector from 'components/OrderingSelector';
import TagSelector from 'components/TagSelector';
import SelectedTags from 'components/SelectedTags';

const FORCED_TAGS = process.env['NEXT_PUBLIC_FORCED_TAGS']?.split(',') ?? [];

// TODO: SSR?
const Templates: NextPage = () => {
const api = useTemplateApi();
const [selectedTags, setSelectedTags] = useState<string[]>([]);
const [ordering, setOrdering] = useState<Ordering | undefined>(undefined);

const templates = useQuery(
['templates', selectedTags, ordering],
() => api.listTemplates(undefined, selectedTags, undefined, ordering),
['templates', selectedTags, FORCED_TAGS, ordering],
() => api.listTemplates(undefined, [...FORCED_TAGS, ...selectedTags], undefined, ordering),
{
keepPreviousData: true,
}
Expand Down

0 comments on commit 75b956f

Please sign in to comment.