connect to backend
This commit is contained in:
parent
6c8d57a7e5
commit
ddeac1aa26
41 changed files with 221 additions and 291 deletions
|
@ -1,7 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
|
||||
export const useInspectionStore = defineStore("inspection", {
|
||||
|
@ -14,10 +13,6 @@ export const useInspectionStore = defineStore("inspection", {
|
|||
},
|
||||
actions: {
|
||||
fetchInspectionByActiveId() {
|
||||
this.loadingActive = "loading";
|
||||
this.activeInspectionObj = inspectionDemoData.find((e) => e.id == this.activeInspection) as InspectionViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/inspection/${this.activeInspection}`)
|
||||
|
@ -34,14 +29,17 @@ export const useInspectionStore = defineStore("inspection", {
|
|||
},
|
||||
async createInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/inspection`, {
|
||||
// TODO: data
|
||||
context: "",
|
||||
inspectionPlanId: "",
|
||||
relatedId: "",
|
||||
assigned: "equipment|vehicle",
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
},
|
||||
async updateActiveInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspection/${inspection.id}`, {
|
||||
// TODO: data
|
||||
context: "",
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue