refactor: add function sendOcr
This commit is contained in:
parent
f308f6da3c
commit
6d1b12fd2f
1 changed files with 34 additions and 0 deletions
34
src/stores/ocr/index.ts
Normal file
34
src/stores/ocr/index.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { api } from 'src/boot/axios';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const useOcr = defineStore('useOcrStore', () => {
|
||||||
|
const baseUrl = import.meta.env.VITE_API_BASE_URL_OCR;
|
||||||
|
|
||||||
|
async function sendOcr(
|
||||||
|
payload: {
|
||||||
|
file: File;
|
||||||
|
},
|
||||||
|
flow?: {
|
||||||
|
sessionId?: string;
|
||||||
|
refTransactionId?: string;
|
||||||
|
transactionId?: string;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const res = await axios
|
||||||
|
.post(`${baseUrl}/`, payload.file, {
|
||||||
|
headers: { 'Content-Type': payload.file?.type },
|
||||||
|
onUploadProgress: (e) => console.log(e),
|
||||||
|
})
|
||||||
|
.catch((e) => console.error(e));
|
||||||
|
// ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
sendOcr,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export default useOcr;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue