Skip to content

Commit

Permalink
fix: list for options
Browse files Browse the repository at this point in the history
  • Loading branch information
uetchy committed Aug 30, 2018
1 parent d57b958 commit 5ef6e1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export async function loadConfig() {
} catch (err) {
if (err.code === 'ENOENT') {
await promisify(fs.writeFile)(CONFIG_PATH, '[]\n', 'utf-8')
return []
} else {
throw new Error(`unhandled load config err: ${err}`)
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function addUser(user: User) {
return new Promise(async (resolve, reject) => {
try {
const config = await loadConfig()
await writeConfig(Object.assign({}, config, user))
await writeConfig([...config, user])
resolve(user)
} catch (err) {
reject(err)
Expand Down

0 comments on commit 5ef6e1b

Please sign in to comment.