Add profile and template pages (scaffolding)
This commit is contained in:
parent
41668498ea
commit
cb67c5d93d
18 changed files with 1067 additions and 158 deletions
19
src/lib/api/profiles.ts
Normal file
19
src/lib/api/profiles.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* API functions for SavedFlightProfile */
|
||||
import type {SavedFlightProfile } from "$lib/types";
|
||||
import { getAPI, postAPI, putAPI, deleteAPI } from "./base";
|
||||
|
||||
export function getSavedFlightProfiles(): Promise<SavedFlightProfile[]> {
|
||||
return getAPI<SavedFlightProfile[]>("/saved-profiles/");
|
||||
}
|
||||
|
||||
export function saveFlightProfile(profile: SavedFlightProfile): Promise<SavedFlightProfile> {
|
||||
return postAPI<SavedFlightProfile>("/saved-profiles/", profile);
|
||||
}
|
||||
|
||||
export function updateFlightProfile(profile: SavedFlightProfile): Promise<SavedFlightProfile> {
|
||||
return putAPI<SavedFlightProfile>(`/saved-profiles/${profile.id}/`, profile);
|
||||
}
|
||||
|
||||
export function deleteFlightProfile(id: number): Promise<void> {
|
||||
return deleteAPI<void>(`/saved-profiles/${id}/`);
|
||||
}
|
||||
19
src/lib/api/templates.ts
Normal file
19
src/lib/api/templates.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* API functions for SavedScenarioTemplate */
|
||||
import type { SavedScenarioTemplate } from "$lib/types";
|
||||
import { getAPI, postAPI, putAPI, deleteAPI } from "./base";
|
||||
|
||||
export function getSavedScenarioTemplates(): Promise<SavedScenarioTemplate[]> {
|
||||
return getAPI<SavedScenarioTemplate[]>("/saved-templates/");
|
||||
}
|
||||
|
||||
export function saveScenarioTemplate(template: SavedScenarioTemplate): Promise<SavedScenarioTemplate> {
|
||||
return postAPI<SavedScenarioTemplate>("/saved-templates/", template);
|
||||
}
|
||||
|
||||
export function updateScenarioTemplate(template: SavedScenarioTemplate): Promise<SavedScenarioTemplate> {
|
||||
return putAPI<SavedScenarioTemplate>(`/saved-templates/${template.id}/`, template);
|
||||
}
|
||||
|
||||
export function deleteScenarioTemplate(id: number): Promise<void> {
|
||||
return deleteAPI<void>(`/saved-templates/${id}/`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue