show render or download
This commit is contained in:
parent
f3ffdb1ffd
commit
28ac0a835b
3 changed files with 82 additions and 12 deletions
|
@ -2,6 +2,7 @@ import { defineStore } from "pinia";
|
|||
import { http } from "@/serverCom";
|
||||
import type { ProtocolPrintoutViewModel } from "../../viewmodels/admin/protocolPrintout.models";
|
||||
import { useProtocolStore } from "./protocol";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const useProtocolPrintoutStore = defineStore("protocolPrintout", {
|
||||
state: () => {
|
||||
|
@ -25,17 +26,11 @@ export const useProtocolPrintoutStore = defineStore("protocolPrintout", {
|
|||
this.loading = "failed";
|
||||
});
|
||||
},
|
||||
fetchProtocolPrintoutById(printoutId: string) {
|
||||
fetchProtocolPrintoutById(printoutId: number): Promise<AxiosResponse<any, any>> {
|
||||
const protocolId = useProtocolStore().activeProtocol;
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/protocol/${protocolId}/printout/${printoutId}`)
|
||||
.then((result) => {
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = "failed";
|
||||
});
|
||||
return http.get(`/admin/protocol/${protocolId}/printout/${printoutId}`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
createProtocolPrintout() {
|
||||
this.printing = "loading";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue