Some ignored filles was missing
This commit is contained in:
parent
7db22245e2
commit
fd5ab6bc0d
268 changed files with 31970 additions and 4 deletions
76
wwwroot/js/utils/URLManager.js
Normal file
76
wwwroot/js/utils/URLManager.js
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* URLManager handles URL query parameter parsing and deep linking functionality
|
||||
* Follows event-driven architecture with no global state
|
||||
*/
|
||||
export class URLManager {
|
||||
constructor(eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
/**
|
||||
* Parse eventId from URL query parameters
|
||||
* @returns eventId string or null if not found
|
||||
*/
|
||||
parseEventIdFromURL() {
|
||||
try {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const eventId = urlParams.get('eventId');
|
||||
if (eventId && eventId.trim() !== '') {
|
||||
return eventId.trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (error) {
|
||||
console.warn('URLManager: Failed to parse URL parameters:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get all query parameters as an object
|
||||
* @returns object with all query parameters
|
||||
*/
|
||||
getAllQueryParams() {
|
||||
try {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const params = {};
|
||||
for (const [key, value] of urlParams.entries()) {
|
||||
params[key] = value;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
catch (error) {
|
||||
console.warn('URLManager: Failed to parse URL parameters:', error);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Update URL without page reload (for future use)
|
||||
* @param params object with parameters to update
|
||||
*/
|
||||
updateURL(params) {
|
||||
try {
|
||||
const url = new URL(window.location.href);
|
||||
// Update or remove parameters
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value === null) {
|
||||
url.searchParams.delete(key);
|
||||
}
|
||||
else {
|
||||
url.searchParams.set(key, value);
|
||||
}
|
||||
});
|
||||
// Update URL without page reload
|
||||
window.history.replaceState({}, '', url.toString());
|
||||
}
|
||||
catch (error) {
|
||||
console.warn('URLManager: Failed to update URL:', error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check if current URL has any query parameters
|
||||
* @returns true if URL has query parameters
|
||||
*/
|
||||
hasQueryParams() {
|
||||
return window.location.search.length > 0;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=URLManager.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue