jaewonhimnae / react-shop-app

318 stars 212 forks source link

Access control #2

Open Blacoffee opened 4 years ago

Blacoffee commented 4 years ago

Hello Jaewon, I wanted to say that i really appreciate your work man, i am working on an e-commerce project for school and your tutorial was very helpful. Thank you very much

Otherwise i need your help, what should i do if i want only the admin to upload new products ? I am kind of new to Full Stack Development and this is my first real world project. I want to hide the upload menu for normal users. I get a lot of errors every time I try to change something in the code.

Can you please help me ? Also i hope you and your family are well, please stay at home and take care ;)

KevinLu commented 4 years ago

You can set role to 1 for your admin user and add a third parameter to Auth in your App.js and set that parameter to true.

<Route exact path="/product/upload" component={Auth(UploadProductPage, true, true)} />
ahsankaleem commented 4 years ago

Hi Sir, It says failed to fetch data

TurboJapuraEfac commented 4 years ago

Hello Jaewon, I wanted to say that i really appreciate your work man, i am working on an e-commerce project for school and your tutorial was very helpful. Thank you very much

Otherwise i need your help, what should i do if i want only the admin to upload new products ? I am kind of new to Full Stack Development and this is my first real world project. I want to hide the upload menu for normal users. I get a lot of errors every time I try to change something in the code.

Can you please help me ? Also i hope you and your family are well, please stay at home and take care ;)

There is a good course in Coursera called Full stack development with react you can check that. You have to authenticate the user whether he is a admin or not before accessing backend