feat(dashboard): add LinkService to fetch dashboard links
This commit is contained in:
parent
6bec12b45a
commit
23d1109604
2 changed files with 22 additions and 0 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
15
src/app/service/link.service.ts
Normal file
15
src/app/service/link.service.ts
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue