javascript – what is the best way to unsubscribe of function in method?

Working on dialog component with angular js and now I find out that my function is subscribed and in if condition do not quit method, but continuously executing another function afterClosed() , here is example of code :

  openCreateNewContentDialog(): void {
    const oldData = this.dataSource.data;
    const dialogConfig = AppConstants.matDialogConfig();
    const dialog = this.dialog.open(LicenseDialogComponent, dialogConfig);

    dialog.beforeClosed().subscribe(licenceDate => {
      for (const datesToCheck of oldData) {
        const newDateFrom = new Date(licenceDate.expirationDateFrom);
        const oldDateTo = new Date(datesToCheck.expirationDateTo.toString());
        if (newDateFrom <= oldDateTo) {
          // console.log('return?');
          return;
        }
      }
    });

    dialog.afterClosed().subscribe(licence => {
      if (licence) {
        this._value.push(licence);
        this.dataSource.data = this.value;
        this.change();
      }
    });
  }

What is the best and optimized way to unsubscribe beforeClosed() function?

Unsubscribe button is missing

I am a social media manager for some Twitter accounts. I can't unsubscribe from one of them because the button under the display button has disappeared. Can someone help me, I sent support tickets but no response from Twitter.
I have to log out for my customers and be able to log in to the other accounts.
Thanks a lot

PHP – Laravel – with Socialite with Outlook 365 how to unsubscribe

After this article I managed to implement in my passport project with Laravel and with "Outlook 365" as a provider

https://docs.microsoft.com/en-us/outlook/rest/php-tutorial

Everything works correctly for me, but I cannot log out of the user. I tried this function, in which I specified all possible methods that come to mind, but still keep the session.

public function logout(Request $request)
{

    Auth::logout();

    Session::flush();
    $request->session()->getHandler()->destroy($request->session()->getId());

    try {
        unset($_SESSION('oauth_state'));
    }
    catch (Exception $e) {
        //
    }

    $tokenCache = new AppTokenStoreTokenCache;
    $tokenCache->clearTokens();

    try {
        $_SESSION = array();
        $request->session()->flush();
        session_unset();
        session_destroy();
        session_reset();

    }
    catch (Exception $e) {
        //
    }

    $_SESSION('access_token') = null;
    $_SESSION('refresh_token') = null;
    $_SESSION('token_expires') = null;

    $request->session()->flush();

    IlluminateSupportFacadesCookie::forget('localhost');
    IlluminateSupportFacadesCookie::forget('laravel_session');

    return view('logout');
}

magento2.2.7 – Page messages for Newsletter E-mail Subscribe / Unsubscribe Will not be displayed

I'm using a third-party theme (RokanThemes Clickbuy), and although I can see the addSuccess / addError command when checking the page, the user will not see a recent page message when clicking on newsletter links in his email to see the success or failure to confirm an error. Which pages should you look for omissions, errors, etc.? Because it looks as if the correct output has been written to the page, nothing is displayed. I have attached a screenshot of the Inspector code. Unfortunately, the formatting for inserting code can not be determined here.

Screenshot of the HTML code

Angular Observables – Do I have to unsubscribe if I do not have a subscription?

I'm using the latest version of Angular 8 and I'm new to the observable concept. Question If I call an observable variable directly and do not apply it to a subscription variable, I still have to log out. Below are the scenarios in which I want to know if I need to log out.
Thanks in advance

Scenario 1 – Calling an httpService from a Component:

Service - httpService

     getContactsHttp(){
         let headers: any = new HttpHeaders(this.authService.getHeadersClient());
         return this.httpClient.get('/contacts', {headers: headers})
          .pipe(timeout(this.authService.getTimeoutLimit('normal')));
        }

Component - Calling getContactsHttp and sorting response

getContacts() {
 this.httpService.getContactsHttp().subscribe((data:any())=>{
  this.records = this.sortData(data)
 })
}

Scenario 2 – on an observable inscribed in a component

contacts$: Observable;

ngOnInit() {
  this.contacts$.subscribe((data:any())=>{
    this.records = this.sortData(data);
  })
}

GUI design – Is it a good idea to hide the unsubscribe button with an error / warning message?

I am creating a secure website, closer to the banking business. I hesitate a bit to hide the unsubscribe link with the error / warning message. I think the design looks simplified when I add errors / warnings through the Logout Panel. I want UX experts to help me in this dilemma. Here are some prototype pictures.
Enter image description here

Note that I have a close button (X) in both the error message and the warning message. The user can close the message to see the logout button.

Here's the reason why I want to do this:

Basically, the error / warning message behaves like a notification message, even a success message is sent there. I wanted to put this in the header because I wanted to place my notification on the master page, not on the content page. That way, I can consistently display the notification.

mock up

download bmml source – Wireframes created with Balsamiq Mockups