cuy-cli 2.0.5 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/bin/index.js +2 -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 (rows != null) {
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 (rows != null) {
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`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cuy-cli",
3
- "version": "2.0.5",
3
+ "version": "3.0.2",
4
4
  "description": "Cuyuniverse Command Line Tools",
5
5
  "main": "index.js",
6
6
  "repository": {