Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eo, api-documentation): add cookie information #3559

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions libs/eo/api-documentation/shell/api-documentation.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, ViewEncapsulation, inject, signal } from '@angular/core';
import { Component, OnInit, ViewEncapsulation, inject, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { TranslocoPipe, TranslocoService } from '@ngneat/transloco';

import { eoApiEnvironmentToken } from '@energinet-datahub/eo/shared/environments';
import { WattIconComponent } from '@energinet-datahub/watt/icon';
import { WattNavListComponent, WattNavListItemComponent, WattShellComponent } from '@energinet-datahub/watt/shell';
import { translations } from '@energinet-datahub/eo/translations';
import { CookieInformationCulture, CookieInformationService } from '@energinet-datahub/gf/util-cookie-information';

const selector = 'eo-api-documentation';

Expand Down Expand Up @@ -96,16 +97,23 @@ const selector = 'eo-api-documentation';
</watt-shell>
`,
})
export class EoApiDocumentationComponent {
export class EoApiDocumentationComponent implements OnInit{
private transloco = inject(TranslocoService);
private activeLang = this.transloco.getActiveLang();
private cookieInformationService: CookieInformationService = inject(CookieInformationService);
private docs = inject(eoApiEnvironmentToken).documentation;

protected translations = translations;
protected afterViewInit = signal<boolean>(false);
protected devPortalHref: string = inject(eoApiEnvironmentToken).developerPortal;
protected links = this.docs.map((doc) => ({ title: doc.title, src: '/' + this.activeLang + '/documentation/' + doc.id }));

ngOnInit(): void {
this.cookieInformationService.init({
culture: this.transloco.getActiveLang() as CookieInformationCulture,
});
}

gotoDevPortal(event: Event) {
event.preventDefault();
window.location.assign(this.devPortalHref);
Expand Down
Loading