angular how to refresh the page without losing the query string they pass to me

Discussão em 'Angular' iniciado por BenTech, Fevereiro 22, 2025.

  1. BenTech

    BenTech Guest

    I'm creating a small booking app, where you don't need to register. I created a method to take the querystring parameter and at startup (ngOinit) it recognizes the parameter as well as the user ID and loads all the appointments taken by the same user id. the problem is that when the reservation was made I inserted a button that closes the confirmation dialog and refreshes the page, after the refresh the page the query string no longer appears and I automatically lose the ability to capture the user ID! could you tell me how i can refresh the page without losing the user ID?

    method for capturing the query:

    public getQueryParameter(key: string): string {
    const parameters = new URLSearchParams(window.location.search);
    return parameters.get(key);


    method that closes the dialogue and reloads the page

    click() {
    const devCode = this.getQueryCode.getQueryParameter('d');
    this.shareDate.device.deviceId = devCode;
    window.location.reload();
    }


    thanks a lot to everyone

    Continue reading...

Compartilhe esta Página