import { defineStore } from 'pinia'

export const useNetworkStore = defineStore('network', {
  state: () => ({
    isOnline: navigator.onLine,
    isLoading: false
  }),
  actions: {
    setOnline(status) {
      this.isOnline = status
      if (status) {
        this.isLoading = false
      }
    },
        startLoading() {
      this.isLoading = true
    },
    stopLoading() {
      this.isLoading = false
    }
  }
})
