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