feat: add events app + "multi-tenants" aka multi-events
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { gamesApiListGames } from "./api";
|
||||
import type { GamesApiListGamesResponse } from "./api/types.gen";
|
||||
import { gamesApiListEventGames } from "./api";
|
||||
import type { GamesApiListEventGamesResponse } from "./api/types.gen";
|
||||
|
||||
interface Props {
|
||||
eventPath: string;
|
||||
marketEnabled?: string | boolean;
|
||||
}
|
||||
|
||||
@@ -11,11 +12,11 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
marketEnabled: true,
|
||||
});
|
||||
|
||||
const games = ref<GamesApiListGamesResponse | undefined>();
|
||||
const games = ref<GamesApiListEventGamesResponse | undefined>();
|
||||
const loading = ref(true);
|
||||
const imageErrors = ref<Set<number>>(new Set());
|
||||
|
||||
const getHeaderImage = (game: GamesApiListGamesResponse[number]) => {
|
||||
const getHeaderImage = (game: GamesApiListEventGamesResponse[number]) => {
|
||||
if (game.image) {
|
||||
return game.image;
|
||||
}
|
||||
@@ -30,7 +31,7 @@ const onImageError = (gameId: number) => {
|
||||
};
|
||||
|
||||
const navigate = (path: string) => {
|
||||
window.location.href = path;
|
||||
window.location.href = `/${props.eventPath}${path}`;
|
||||
};
|
||||
|
||||
const isMarketEnabled = () => {
|
||||
@@ -41,8 +42,10 @@ const isMarketEnabled = () => {
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
// Fetch games list
|
||||
const response = await gamesApiListGames();
|
||||
// Fetch games enabled for this event
|
||||
const response = await gamesApiListEventGames({
|
||||
path: { event_path: props.eventPath },
|
||||
});
|
||||
if (response.data) {
|
||||
games.value = response.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user