NZedan / proshop_mern

Course project from Brad Traversy's MERN eCommerce course
2 stars 1 forks source link

Hello, Assistance Needed. #2

Closed talmax1124 closed 1 year ago

talmax1124 commented 1 year ago

Hello, I need assistance with the Add to Cart & Reduce Stock.

I have tried implementing both, but for example, the Add To Cart Functionality but it doesn't add the qty to the existing product. and I can't find the code for reducing stock.

If you could make a Pull Request on my repo, that will be so greatly appreciated.

Repo URL: https://github.com/talmax1124/creativeduoshop

NZedan commented 1 year ago

Hi, I will take a look and get back to you.

talmax1124 commented 1 year ago

Hi, I will take a look and get back to you.

@NZedan Ok, thank you. And I just moved to another repo because I was trying to upgrade to react 18, but some of the components still hasn't catched up to it.

The new URL: github.com/talmax1124/cdshop22

talmax1124 commented 1 year ago

Hi, I will take a look and get back to you.

You could also use some of my code. I implemented stripe checkout, forgot password, user mail validation with email, and some other things.

Thanks again for looking at it @NZedan

talmax1124 commented 1 year ago

@NZedan Hey, were you able to make it work?

NZedan commented 1 year ago

Hi, I'm trying to set up the oauth strategy, what should I put as the api uri?

talmax1124 commented 1 year ago

Oh, the oath, for google? It is only working in prod for some reason but just put the localhost port which should be 7500 if I'm right

talmax1124 commented 1 year ago

Hi, I'm trying to set up the oauth strategy, what should I put as the api uri?

@NZedan Did that get it to work?

talmax1124 commented 1 year ago

@NZedan Your ENV file should look like this:

NODE_ENV = development PORT = 7500 MONGO_URI = JWT_SECRET = 'abc123' REACT_EDITOR = atom STRIPE_PUBLISHABLE_KEY = STRIPE_SECRET_KEY = = CLOUDINARY_API_KEY = = CLOUDINARY_API_SECRET = CLOUDINARY_CLOUD_NAME = GOOGLE_CLIENT_ID = GOOGLE_CLIENT_SECRET = MailGunAPI = MailGunDomain = API_URI=http://localhost:7500 ORIGIN_URI=http://localhost:3000 SESSION_SECRET= rgrwtwre CLIENT_URL = http://localhost:3000

NZedan commented 1 year ago

Thanks @talmax1124, I couldn't get all the necessary credentials going to get your project fully operational on my system and I don't have much time on this at the mo, so I have made some changes to your code for the things you requested but as I can't run it, it may or may not work! Hopefully it will give you some idea of what I was doing. I have added a message field to the order model that you can pick up on the order screen to implement order timeouts/expiry etc. Hope this helps.

talmax1124 commented 1 year ago

Ok, I'll check it right now. Thanks!

talmax1124 commented 1 year ago

@NZedan I get this error file:///Users/carlitos/cdshop22/backend/controllers/orderController.js:330 [1] getOrderById, [1] ^^^^^^^^^^^^ [1] [1] SyntaxError: Duplicate export of 'getOrderById' [1] at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:115:18) [1] at ESMLoader.moduleProvider (node:internal/modules/esm/loader:289:14)

talmax1124 commented 1 year ago

Could you get on a discord chat (not call) and get on my live server

On Tue, Aug 23, 2022 at 8:45 PM Carlos @.***> wrote:

@NZedan https://github.com/NZedan I get this error file:///Users/carlitos/cdshop22/backend/controllers/orderController.js:330 [1] getOrderById, [1] ^^^^^^^^^^^^ [1] [1] SyntaxError: Duplicate export of 'getOrderById' [1] at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:115:18) [1] at ESMLoader.moduleProvider (node:internal/modules/esm/loader:289:14)

— Reply to this email directly, view it on GitHub https://github.com/NZedan/proshop_mern/issues/2#issuecomment-1225034133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVNS3T7CJI232LAFG4LFHDV2VWBZANCNFSM56UAZ4VA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

NZedan commented 1 year ago

I won't have time until next week. Remove "export" from line 144 of orderController

talmax1124 commented 1 year ago

Ok! Still couldn't get it fixed. @NZedan

talmax1124 commented 1 year ago

Hello! Could you do it? @NZedan

talmax1124 commented 1 year ago

@NZedan

NZedan commented 1 year ago

Hi Carlos, I'm sorry I can't work on your code for you, you will have to look closely at the code I have given you to see how it is working and work through any errors you encounter systematically.

Check the package.json in your frontend folder as I may have forgotten to change the proxy back to 7500 (I set it to 6000 when I was trying to get it working).