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(),
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user