Adds the new shows admin screen and drives schedule from it
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
import { getAppConfig } from './app-config.service';
|
||||
|
||||
/** Shared service for uploading image files via the admin API. */
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UploadService {
|
||||
private http = inject(HttpClient);
|
||||
private baseUrl = `${getAppConfig().apiBaseUrl}/api/upload/image`;
|
||||
|
||||
/** Upload an image file. Returns the relative URL (e.g. `uploads/abc123.png`). */
|
||||
async uploadImage(file: File): Promise<string> {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const response = await firstValueFrom(
|
||||
this.http.post<{ url: string }>(this.baseUrl, formData),
|
||||
);
|
||||
return response.url;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user