import { defineStore } from 'pinia'

interface LoadingState {
  trackingTableLoading: boolean
}

export const useLoadingState = defineStore('loadingState', {
  state: (): LoadingState => ({
    trackingTableLoading: JSON.parse(localStorage.getItem('trackingTableLoading')) || false
  }),
  getters: {},
  actions: {
    setTrackingTableLoading(state: boolean) {
      localStorage.setItem('trackingTableLoading', JSON.stringify(state))
      this.trackingTableLoading = state
    }
  }
})
