Patpatpatrick / Way2Recycle

Way2Recycle
3 stars 1 forks source link

Fixing issues in develop (you guys can check it out after the exam) #34

Closed hlee2052 closed 5 years ago

hlee2052 commented 5 years ago

At this point, I think its good idea to delete existing entries in your local database because we may have changed some stuff (eg, fields name of a mongo document, and your OLD database entry could be incompatible).

You can use MongoDB Compass to do this:

  1. while your meteor is running, open a new command line and type: meteor mongo -U
  2. copy the string (eg, mongodb://127.0.0.1.....)
  3. Open Compass and create new connection. At this point, it will say connection string detected.
  4. connect and go to database : meteor
  5. delete DOCUMENTS for Collection: items and users only.

Fixed:

  1. fixed the issue where dashboard was not showing user items correctly (due to the fact that when the user inputs appliance data and press submit, user id was stored as null in mongodb, thus nothing showed up. This was probably because in reducer, postDefaultState: {Meteor.userId() ...} is null at start and does not get updated even after user logs in ( I think...)

postDefaultState = { user_id: Meteor.userId(), title: 'An item', .... }

  1. a)fixed the issue user dashboard and other pages persist after pressing log out. Pressing log out should redirect you to home page. b) my items and post ad will only show up when user logs in.

known bug (minor): if you refresh page while user is logged in, you will be still logged in but "Hello NAME...etc" disappears unless you go to different tab, etc (Meteor user() issue, may revisit later)

I hope I did not miss anything please let me know if you find any other issues.

cynthiaxzh commented 5 years ago

The updated functions work well.