# Sidenav

Configure seu menu, utilizando informações do token ou as que desejar após a autenticação do usuário ou libere para acesso público utilizando o componente de Sidenav do Cat UI

### Uso

```typescript
import { Injectable } from "@angular/core";
import { AppConfigMenu,CatAppDecodedToken } from "@catrx/ui";
import { Observable } from 'rxjs/internal/Observable';

@Injectable({ providedIn: 'any' })
export class UserService {

  public getMenu(decodedToken: CatAppDecodedToken) {
    return new Observable<AppConfigMenu>((observe) => {
      observe.next({
        modules: [
          {
            icon: 'fa-solid fa-database',
            name: 'Exibição de Dados',
            tools: [
              {
                name: 'Datatable',
                hasPermission: () => !!decodedToken,
                routerLink: './components/datatable',
              },
              {
                name: 'Componentes Dinâmicos',
                hasPermission: () => !!decodedToken,
                routerLink: './components/dynamic-components',
              },
            ],
          },
          {
            icon: 'fa-brands fa-wpforms',
            name: 'Formulário',
            tools: [
              {
                name: 'Formulário Dinâmico',
                hasPermission: () => true,
                routerLink: './components/form',
              },
            ],
          },
        ],
      });
    });
  }
}
```

<pre class="language-typescript" data-title="app.component.ts"><code class="lang-typescript">import { Component } from '@angular/core';
import { CatAppService } from '@catrx/ui';
import { CatDynamicComponent } from '@catrx/ui/dynamic-component';
import { UserService } from './user.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
})
export class AppComponent {
  appConfig = this.appService
<strong>    .build('Cat UI', { ... },
</strong>      onAuth: (decodedToken) => this.userService.getMenu(decodedToken),
    })
    .generate();

  constructor(
    private appService: CatAppService,
    private userService: UserService) {}
}
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.catui.igordrangel.com.br/menu/sidenav.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
