need some advice here.
My Nuxt & Firebase/Firestore web app will have 3 different type of users:
- subcontractor
- contractor
- worker
First, I want my users, whenever they login, they will log into page related to their user type. e.g: subcontractor login push to /subcontractor, contractor login push to /contractor etc etc.
I also want the user can only see pages related to their types. (user A only see /A & /Atwo, user B can only see /B & /Btwo, user C, can only see /C & /Ctwo etc etc..)
I want to avoid using cloud functions if can, as from what I understand, you cannot deploy your app in the free plan if your app has cloud functions in it.
Anyway, is below the right way to do it?
- Create in firestore, Users document that contains details of user type, e.g: "userType: subcontractor"
- In the middleware, do the logic, based on user type. (in my case, I need to have 3 diff middleware js file (isSubcontractor.js, isContractor.js, isWorker.js)
- add middleware: "the-middleware file", inside my page
If its correct, how to do step 1 & 2? Is there any articles or real-life application source code that explain briefly what I wanted?
Beginner here. Already gone thru here and there around the internet but can't quite find the answer that I wanted :(