Redirect User to different routes depending on their role

I have come across a issue when i am creating a POS app in ERPNext and i made a role called POS User and wanted to make it so if user has that role he should directly be redirected to the Point of sale page but could not find much information on the redirection module so i did a little more digging and made a custom app for redirecting users depending on their role

bench new-app [app_name]
bench --site [site_name] install-app [app_name]
cd /home/user/frappe-bench/apps/[app_name]/[app_name]/
nano hooks.py

Add this line in hooks.py

after_login = "[app_name].utils.redirect_after_login"
cd public/js
nano login_redirect.js
$(document).ready(function() {
  console.log(frappe.session.user);
  if(frappe.user.has_role("POS User")&& window.location.pathname !== "/app/point-of-sale"){
  window.location.href = "/app/point-of-sale";
  }
});

sudo bench build && sudo bench restart

And this is all that is needed for me at least hope this works for you too and if i made any mistake or if my approach is wrong please correct me.
Thank You.
M Saad