I’m having a problem in Vue.js with handling multiple users. Before transitioning to this integration, my previous authentication used mixins to handle privileges for each user. Now, I want to use Vue as the frontend, but I’m unsure how to integrate it. I’m using the following user roles:
#models.py
class User(AbstractUser):
is_secretary = models.BooleanField(default=False)
is_staff = models.BooleanField(default=False)
is_superuser = models.BooleanField(default=False)
contact_number = models.CharField(max_length=20, blank=True, null=True)
REQUIRED_FIELDS = []
def user_type(self):
if self.is_superuser:
return "Superuser"
elif self.is_secretary:
return "Secretary"
elif self.is_staff:
return "Staff"
else:
return "User"
def __str__(self):
return f"{self.first_name} {self.last_name} ({self.user_type()})"
I’m using serializers to manage user data.
How should I handle this in Vue.js? Any advice or examples would be appreciated.
Depending on each user’s role, I want to redirect them to their specific dashboard.
VILLAREAL GRANT GIL A. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.