feat: add events app + "multi-tenants" aka multi-events
This commit is contained in:
@@ -25,9 +25,9 @@ export const useMarketStore = defineStore('market', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const loadMarkets = async () => {
|
||||
const loadMarkets = async (eventPath: string) => {
|
||||
try {
|
||||
const response = await marketApiListMarkets()
|
||||
const response = await marketApiListMarkets({ path: { event_path: eventPath } })
|
||||
if (response.data) {
|
||||
markets.value = response.data as unknown as Market[]
|
||||
}
|
||||
@@ -37,9 +37,9 @@ export const useMarketStore = defineStore('market', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const loadUserBets = async () => {
|
||||
const loadUserBets = async (eventPath: string) => {
|
||||
try {
|
||||
const response = await marketApiListUserBets()
|
||||
const response = await marketApiListUserBets({ path: { event_path: eventPath } })
|
||||
if (response.data) {
|
||||
userBets.value = response.data
|
||||
}
|
||||
@@ -49,30 +49,30 @@ export const useMarketStore = defineStore('market', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const initializeMarketPage = async () => {
|
||||
const initializeMarketPage = async (eventPath: string) => {
|
||||
isLoading.value = true
|
||||
error.value = ''
|
||||
|
||||
try {
|
||||
await Promise.all([
|
||||
loadUserInfo(),
|
||||
loadMarkets(),
|
||||
loadMarkets(eventPath),
|
||||
])
|
||||
|
||||
// Load user bets if authenticated
|
||||
if (userInfo.value?.is_authenticated) {
|
||||
await loadUserBets()
|
||||
await loadUserBets(eventPath)
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const refreshPage = async () => {
|
||||
const refreshPage = async (eventPath: string) => {
|
||||
await Promise.all([
|
||||
loadUserInfo(),
|
||||
loadMarkets(),
|
||||
userInfo.value?.is_authenticated ? loadUserBets() : Promise.resolve(),
|
||||
loadMarkets(eventPath),
|
||||
userInfo.value?.is_authenticated ? loadUserBets(eventPath) : Promise.resolve(),
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ export const usePuzzlesStore = defineStore('puzzles', () => {
|
||||
})
|
||||
|
||||
// Actions
|
||||
const loadPuzzles = async () => {
|
||||
const loadPuzzles = async (eventPath: string) => {
|
||||
if (puzzles.value.length > 0) return // Already loaded
|
||||
|
||||
try {
|
||||
isLoading.value = true
|
||||
error.value = ''
|
||||
|
||||
const response = await opusMagnumApiListPuzzles()
|
||||
const response = await opusMagnumApiListPuzzles({ path: { event_path: eventPath } })
|
||||
if (response.error) {
|
||||
error.value = String(response.error)
|
||||
console.error('Failed to load puzzles:', response.error)
|
||||
@@ -56,9 +56,9 @@ export const usePuzzlesStore = defineStore('puzzles', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const refreshPuzzles = async () => {
|
||||
const refreshPuzzles = async (eventPath: string) => {
|
||||
puzzles.value = []
|
||||
await loadPuzzles()
|
||||
await loadPuzzles(eventPath)
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user