import {defineStore} from 'pinia'
import {ref} from 'vue'

export const useNavStore = defineStore(
  'nav',
  () => {
    const navIndex = ref('/')
    const showLoad = ref(true)

    const changeNavIndex = (id) => {
      if (!id) {
        return
      } else {
        navIndex.value = id
      }
    }

    const setLoad = (status) => {
      console.log('status===>', status)
      showLoad.value = status
    }

    return {
      navIndex,
      showLoad,
      changeNavIndex,
      setLoad,
    }
  },
  {
    persist: {
      storage: sessionStorage,
    },
  }
)
