diff --git a/db/save-token.js b/db/save-token.js index c06eb32..996b8fb 100644 --- a/db/save-token.js +++ b/db/save-token.js @@ -2,9 +2,9 @@ import { connection } from "./connection.js"; import { getTokenByUserId } from "./get-token.js"; export async function saveToken(userId, token) { - const token = await getTokenByUserId(userId); + const existToken = await getTokenByUserId(userId); - if (!token){ + if (!existToken){ const [rows, fields] = await connection.execute('insert into tokens values(?, ?)', [userId, token]); console.log(`${new Date()}: ${userId} save Token`) return rows;