Skip to content

Issue: Improve Username Retrieval Logic #354

Description

@Yashaswini-K-P

Problem
The current method of parsing the username via URL path segments (window.location.pathname.split("/")) is fragile. It breaks if the URL structure changes, if there is a trailing slash, or if new sub-paths are added to your routing.

Requirement
Decouple the username from the URL entirely. You need a reliable "source of truth" for the current user's identity that the frontend can read regardless of how the URL is structured.

What is needed

  1. Inject the username: Pass the username from your backend into the HTML <head> using a <meta> tag when the page loads.
  2. Centralize access: Create a single, small helper function that reads this meta tag.
  3. Replace old logic: Remove the URL parsing logic from all your individual files (ranks.js, historical-graphs.js, etc.) and replace it with a call to this new helper function.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions