~mna/hockeysim

9c153d207be1addc2f9c7c3497082a1f125d6666 — Martin Angers 1 year, 1 month ago 9152d21
add confirm step to archive league
2 files changed, 11 insertions(+), 3 deletions(-)

M src/cmds/league_cmds/archive.js
M src/cmds/league_cmds/new.js
M src/cmds/league_cmds/archive.js => src/cmds/league_cmds/archive.js +9 -1
@@ 22,6 22,12 @@ function leagueSelectionQuestion (conn) {
        },
        pageSize: 10,
      },
      {
        type: 'confirm',
        name: 'confirm',
        message: 'Archive this league?',
        default: true,
      },
    ])
  }
}


@@ 36,7 42,9 @@ export async function handler (argv) {
  try {
    const prompt = await leagueSelectionQuestion (conn)
    const res = await prompt ()
    await exec (conn, res)
    if (res.confirm) {
      await exec (conn, res)
    }
  } finally {
    await conn.end ()
  }

M src/cmds/league_cmds/new.js => src/cmds/league_cmds/new.js +2 -2
@@ 113,7 113,7 @@ function confirmationQuestion (pres) {
  return inquirer.prompt ([
    {
      type: 'confirm',
      name: 'confirmCreate',
      name: 'confirm',
      message: 'Create this league?',
      default: true,
      when (res) {


@@ 142,7 142,7 @@ export async function handler (argv) {
    const prompt = (init) => promises.reduce ((p, f) => p.then (f), Promise.resolve (init))

    const res = await prompt ({ teams: [] })
    if (res.confirmCreate) {
    if (res.confirm) {
      await exec (conn, res)
    }
  } finally {