import { defineStore } from 'pinia'
import { getJobs } from '@/api/jobs'

export const useJobStore = defineStore('job', {
  state: () => ({ jobs: [], total: 0, loading: false }),
  actions: {
    async fetchJobs(params) {
      this.loading = true
      const { data } = await getJobs(params)
      this.jobs = data.results
      this.total = data.count
      this.loading = false
    },
  },
})
