
import { makeAuthJson } from './login'
import { loginFetch } from './login-fetch'
import { getStashById } from './login-selectors'


/**
 * Deletes a login from the server.
 */
export async function deleteLogin(
  ai,
  login
) {
  const { stashTree } = getStashById(ai, login.loginId)
  await loginFetch(
    ai,
    'POST',
    '/v2/login/delete',
    makeAuthJson(stashTree, login)
  )
}
