feat(dashboard): add LinkService to fetch dashboard links

This commit is contained in:
Jan Gleytenhoover 2025-01-19 21:07:31 +01:00
parent 6bec12b45a
commit 23d1109604
Signed by: jank
GPG key ID: 50620ADD22CD330B
2 changed files with 22 additions and 0 deletions

View file

@ -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);
});
}
}

View file

@ -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<RecordModel[]> {
return this.pb.collection('links').getFullList();
}
}