cuy-cli 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/index.js +2 -2
- package/package.json +1 -1
package/bin/index.js
CHANGED
@@ -57,7 +57,7 @@ const cuyPost = (data) => {
|
|
57
57
|
console.warn('Maaf, saat ini data yang anda masukan tidak dapat kami proses.')
|
58
58
|
return db.destroy();
|
59
59
|
}
|
60
|
-
if (!err) {
|
60
|
+
if (!err && rows.length > 0) {
|
61
61
|
const { username, id } = rows[0]
|
62
62
|
db.query(`INSERT INTO posts (description, hashtag, author, user_id, created_at, updated_at) VALUES ('${data.description}', '${data.hashtag.replaceAll(' ', '')}', '${username}', '${id}', '${now}', '${now}')`, (err, rows) => {
|
63
63
|
if (!err) {
|
@@ -78,7 +78,7 @@ const cuyPost = (data) => {
|
|
78
78
|
|
79
79
|
const lastSeen = ({ username }) => {
|
80
80
|
db.query(`select last_seen from users where username='${username}'`, (err, rows) => {
|
81
|
-
if (!err) {
|
81
|
+
if (!err && rows.length > 0) {
|
82
82
|
last_seen = rows[0].last_seen
|
83
83
|
if (last_seen == null) {
|
84
84
|
console.info(`${username} belum pernah login`);
|