17 lines
480 B
TypeScript
17 lines
480 B
TypeScript
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
import { useSolarNetwork } from '~/composables/useSolarNetwork'
|
|
import type { SnPublisher } from '~/types/api'
|
|
|
|
export const usePubStore = defineStore('pub', () => {
|
|
const publishers = ref<SnPublisher[]>([])
|
|
|
|
async function fetchPublishers() {
|
|
const api = useSolarNetwork()
|
|
const resp = await api('/publishers')
|
|
publishers.value = resp as SnPublisher[]
|
|
}
|
|
|
|
return { publishers, fetchPublishers }
|
|
})
|