27 lines
609 B
TypeScript
27 lines
609 B
TypeScript
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
import type { InviteActivitySummary } from '@mp-pilates/shared'
|
|
import { get } from '../utils/request'
|
|
|
|
export const useInviteStore = defineStore('invite', () => {
|
|
const activity = ref<InviteActivitySummary | null>(null)
|
|
const loading = ref(false)
|
|
|
|
async function fetchActivity() {
|
|
loading.value = true
|
|
try {
|
|
activity.value = await get<InviteActivitySummary>('/invite/activity')
|
|
return activity.value
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
return {
|
|
activity,
|
|
loading,
|
|
fetchActivity,
|
|
}
|
|
})
|
|
|