refactor: fix missing await and bad practices

This commit is contained in:
2022-07-08 11:40:55 +05:30
parent e1c79a1840
commit 899ffa1799
5 changed files with 39 additions and 41 deletions

View File

@ -8,12 +8,7 @@ export const getAvailableWord = async (db: Pool): Promise<Word | undefined> => {
.query(Query.getAvailableWord)
.catch((err) => err);
if (data != undefined) {
let word = data.rows[0];
return word;
}
return undefined;
return data?.rows[0];
};
export const setWordTaken = async (db: Pool, id: number) => {