import { get } from '@vue2-client/services/api'
import Vue from 'vue'

async function loginStart (name, password) {
  const resource = await get(`/rs/user/${name}/${password}/智慧OA`, {})
  console.log('登陆获取', resource)
  Vue.$login.f = resource
  await Promise.all([Vue.$appdata.load()])
  const login = {
    f: Vue.$login.f,
    jwt: Vue.$login.f.id,
    r: Vue.$login.r
  }
  Vue.$store.commit('account/setLogin', login)
  return resource
}

export {
  loginStart
}
