diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 65db9aa..f9cae2b 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { LinkService } from '../service/link.service'; @Component({ selector: 'app-dashboard', @@ -7,5 +8,11 @@ import { Component } from '@angular/core'; styleUrl: './dashboard.component.css' }) export class DashboardComponent { + constructor(private linkService: LinkService) { }; + ngOnInit(): void { + this.linkService.getLinks().then(links => { + console.log(links); + }); + } } diff --git a/src/app/service/link.service.ts b/src/app/service/link.service.ts new file mode 100644 index 0000000..8b4a4ea --- /dev/null +++ b/src/app/service/link.service.ts @@ -0,0 +1,15 @@ +import { Injectable } from "@angular/core"; +import { environment } from "../../environments/environment.development"; +import PocketBase, { RecordModel } from 'pocketbase'; + + +@Injectable({ + providedIn: 'root' +}) +export class LinkService { + private pb = new PocketBase(environment.POCKETBASE); + + getLinks(): Promise { + return this.pb.collection('links').getFullList(); + } +}