import { create } from 'zustand'

import type { AccountStore } from '../../global/type'

export const useAuthStore = create<AccountStore>((set) => ({
  accounts: [],
  onInitialize: () => {
    console.log('useFlowStore onInitialize')

    // const accountClient = new AccountClient({}, apiUrl)
    // const accounts = await accountClient.account_GetAccounts()
    // if (accounts.length > 0) {
    //   get().setAccounts(accounts)
    // }
  },
  setAccounts: (accounts) => {
    set((state) => ({
      ...state,
      accounts: accounts,
    }))
  },
}))
