This commit is contained in:
Daniel 2024-11-13 08:22:55 -05:00
parent f2b325c8a4
commit 7af1dd1720
3 changed files with 7 additions and 4 deletions

View file

@ -6,6 +6,7 @@
placeholder="Paste RadioReference page here"
formControlName="contents"
></textarea>
<input type="number" class="input input-bordered" formControlName="systemID" id="systemID" />
<input type="submit" class="btn btn-secondary" value="Save" />
</form>
</div>

View file

@ -26,11 +26,13 @@ export class ImportComponent {
ngOnInit() {
this.form = new FormGroup({
contents: new FormControl(''),
systemID: new FormControl(0),
});
}
submit() {
let content = this.form.controls['contents'].value;
this.tgService.importRR(content)
let sysID = Number(this.form.controls['systemID'].value);
this.tgService.importRR(sysID, content)
.pipe(
catchError(() => {
return of(null);

View file

@ -18,9 +18,9 @@ export class TalkgroupService {
return this.http.get<Talkgroup>(`/api/talkgroup/${sys}/${tg}`);
}
importRR(content: string): Observable<Talkgroup[]> {
return this.http.put<Talkgroup[]>('/api/talkgroup/import',
{type: 'radioreference', body: content});
importRR(sysID: number, content: string): Observable<Talkgroup[]> {
return this.http.post<Talkgroup[]>('/api/talkgroup/import',
{systemID: sysID, type: 'radioreference', body: content});
}
putTalkgroup(tu: TalkgroupUpdate): Observable<Talkgroup> {