connect to backend
This commit is contained in:
parent
6c8d57a7e5
commit
ddeac1aa26
41 changed files with 221 additions and 291 deletions
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import { useWearableStore } from "./wearable";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
|
||||
export const useWearableDamageReportStore = defineStore("wearableDamageReport", {
|
||||
state: () => {
|
||||
|
@ -15,17 +14,11 @@ export const useWearableDamageReportStore = defineStore("wearableDamageReport",
|
|||
actions: {
|
||||
fetchDamageReportForWearable(offset = 0, count = 25, search = "", clear = false) {
|
||||
const wearableId = useWearableStore().activeWearable;
|
||||
this.damageReports = damageReportDemoData
|
||||
.filter((drdd) => drdd.relatedId == wearableId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/wearable/${wearableId}/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/damagereport/wearable/${wearableId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue