import { defineStore } from 'pinia'

export const useTabbar = defineStore('tabbar', {
  state() {
    return {
      currentTabbar: 'work',
      roleType: 0
    }
  },
  actions: {
    setCurrentTabbar(current: string) {
      this.currentTabbar = current
    },
    setRoleType(type: number) {
      this.roleType = type
    }
  },
  persist: {
    storage: {
      getItem(key: string): string | null {
        return uni.getStorageSync(key)
      },
      setItem(key: string, value: string) {
        return uni.setStorageSync(key, value)
      }
    }
  }
})
