repair create and view
This commit is contained in:
parent
b5a3ff4dc6
commit
c79d5bb1cd
18 changed files with 1046 additions and 59 deletions
|
@ -1,5 +1,9 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type { RepairViewModel, UpdateRepairViewModel } from "@/viewmodels/admin/unit/repair.models";
|
||||
import type {
|
||||
CreateRepairViewModel,
|
||||
RepairViewModel,
|
||||
UpdateRepairViewModel,
|
||||
} from "@/viewmodels/admin/unit/repair.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
|
@ -94,6 +98,17 @@ export const useRepairStore = defineStore("repair", {
|
|||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
async createRepair(repair: CreateRepairViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/repair`, {
|
||||
affected: repair.affected,
|
||||
affectedId: repair.affectedId,
|
||||
title: repair.title,
|
||||
description: repair.description,
|
||||
responsible: repair.responsible,
|
||||
reports: repair.reports,
|
||||
});
|
||||
return result;
|
||||
},
|
||||
async updateRepair(repair: UpdateRepairViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/repair/${repair.id}`, {
|
||||
status: repair.status,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue