add token on file upload
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
:maxFileSize="20971520"
|
||||
:invalidFileSizeMessage="'Invalid file size, file size should be smaller than 20 MB'"
|
||||
v-model:files="uploadedFiles"
|
||||
@before-send="onBeforeSend"
|
||||
|
||||
>
|
||||
<template #content="{ files, uploadedFiles, removeUploadedFileCallback, removeFileCallback }">
|
||||
<div class="pt-4">
|
||||
@@ -103,6 +105,9 @@
|
||||
:showCancelButton="false"
|
||||
:maxFileSize="20971520"
|
||||
v-model:files="uploadedFiles"
|
||||
@before-send="onBeforeSend"
|
||||
|
||||
>
|
||||
>
|
||||
<template #content="{ files, uploadedFiles, removeUploadedFileCallback, removeFileCallback }">
|
||||
<div class="pt-4">
|
||||
@@ -272,7 +277,9 @@
|
||||
|
||||
<script setup>
|
||||
import ChangeImpactOutputViewer from '@/components/ChangeImpactOutputViewer.vue';
|
||||
import ChatClient from '@/components/ChatClient.vue';
|
||||
import { LoadingStore } from '@/stores/LoadingStore';
|
||||
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||
import axios from 'axios';
|
||||
import JsonEditorVue from 'json-editor-vue';
|
||||
import JSZip from 'jszip';
|
||||
@@ -287,10 +294,9 @@ import Textarea from 'primevue/textarea';
|
||||
import { useConfirm } from 'primevue/useconfirm';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { JellyfishLoader } from 'vue3-spinner';
|
||||
import { ScenarioService } from '../../service/ScenarioService';
|
||||
import ChatClient from '@/components/ChatClient.vue';
|
||||
|
||||
const loadingStore = LoadingStore();
|
||||
const toast = useToast();
|
||||
@@ -332,6 +338,7 @@ const fileContent = ref('');
|
||||
const fileType = ref('');
|
||||
const reqMultiFile = ref(false);
|
||||
const chat_enabled = ref(false);
|
||||
const auth = useAuth();
|
||||
|
||||
let startTime = ref(null);
|
||||
let timerInterval = ref(null);
|
||||
@@ -411,6 +418,13 @@ function fetchScenario(id) {
|
||||
});
|
||||
}
|
||||
|
||||
const onBeforeSend = (event) => {
|
||||
const { xhr } = event; // Estraggo l'oggetto XMLHttpRequest
|
||||
console.log('xhr', xhr);
|
||||
var token = auth.token()
|
||||
xhr.setRequestHeader('Authorization', 'Bearer ' + token); // Imposta il tipo di contenuto
|
||||
};
|
||||
|
||||
const getInputComponent = (type) => {
|
||||
switch (type) {
|
||||
case 'text':
|
||||
|
||||
Reference in New Issue
Block a user