From d0ac5f2737f820f7134d857fd1990074fa0f8094 Mon Sep 17 00:00:00 2001 From: Hans-Christian Payer Date: Wed, 24 Jun 2026 13:04:40 +0200 Subject: [PATCH] Directus API-Key aus Code entfernen --- src/app/links.service.ts | 27 +++++++++------------------ src/app/links.ts | 5 +++++ src/app/links/links.component.html | 2 +- src/app/links/links.component.ts | 4 ++-- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/app/links.service.ts b/src/app/links.service.ts index 4d03ac0..a3aded3 100644 --- a/src/app/links.service.ts +++ b/src/app/links.service.ts @@ -1,29 +1,20 @@ import { Injectable } from '@angular/core'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Links } from './links'; +import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -import * as _ from 'lodash'; - +import { LinksResponse } from './links'; // ← Import ergänzen @Injectable({ providedIn: 'root' }) export class LinksService { + private apiUrl = 'http://directus.neugasse.lan/items/landingpage'; + + httpOptions = {}; + constructor(private http: HttpClient) { } - private apiUrl = 'http://directus.neugasse.lan/items/landingpage'; - public apiKey = 'KGjpxZ3tesmhEXHS7C7JbKDyW6YJlgQT'; - httpOptions = { - headers: new HttpHeaders({ - 'Authorization': `Bearer ${this.apiKey}`, - }), - }; - - getLinks(): Observable { - return this.http - .get(this.apiUrl, this.httpOptions) - - - } + getLinks(): Observable { // ← doppeltes g entfernt + return this.http.get(this.apiUrl); + } } diff --git a/src/app/links.ts b/src/app/links.ts index 98583e9..e311559 100644 --- a/src/app/links.ts +++ b/src/app/links.ts @@ -6,3 +6,8 @@ export interface Links { link: string; link_zu_software: string } + +export type LinkItem = Links; // ← Alias, kein Breaking Change +export interface LinksResponse { + data: LinkItem[]; +} diff --git a/src/app/links/links.component.html b/src/app/links/links.component.html index 3b482b6..28b9cdc 100644 --- a/src/app/links/links.component.html +++ b/src/app/links/links.component.html @@ -5,7 +5,7 @@ {{ link.name }} -  {{ link.name }} + {{ link.name }}" style="width:100px" >

{{ link.beschreibung }}

diff --git a/src/app/links/links.component.ts b/src/app/links/links.component.ts index 80d6665..9ced70c 100644 --- a/src/app/links/links.component.ts +++ b/src/app/links/links.component.ts @@ -10,7 +10,7 @@ import { Subscription } from 'rxjs'; export class LinksComponent implements OnInit { linkList: any = []; - apiKey = this.linkservice.apiKey; + //apiKey = this.linkservice.apiKey; constructor (public linkservice: LinksService) {} @@ -21,7 +21,7 @@ export class LinksComponent implements OnInit { getLinks() { return this.linkservice.getLinks().subscribe((data: any) => { this.linkList = data.data; - this.apiKey; + //this.apiKey; console.log(this.linkList); });