- Iniziato a scrivere la CHATBOT...
This commit is contained in:
BIN
1_module copia.jpg
Normal file
BIN
1_module copia.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 536 KiB |
@@ -162,6 +162,7 @@ export const shared_consts = {
|
|||||||
CATALOGO: 310,
|
CATALOGO: 310,
|
||||||
RACCOLTA: 315,
|
RACCOLTA: 315,
|
||||||
TOOLSAI: 320,
|
TOOLSAI: 320,
|
||||||
|
CHATBOT: 325,
|
||||||
MAPPA: 350,
|
MAPPA: 350,
|
||||||
MAPPAUTENTI: 360,
|
MAPPAUTENTI: 360,
|
||||||
MAPPACOMUNI: 370,
|
MAPPACOMUNI: 370,
|
||||||
@@ -1976,6 +1977,14 @@ export const shared_consts = {
|
|||||||
value: 315,
|
value: 315,
|
||||||
label: 'RACCOLTA CATALOGHI',
|
label: 'RACCOLTA CATALOGHI',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: 320,
|
||||||
|
label: 'TOOLS AI',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 325,
|
||||||
|
label: 'CHATBOT',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: 350,
|
value: 350,
|
||||||
label: 'MAPPA',
|
label: 'MAPPA',
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ export default defineComponent({
|
|||||||
]
|
]
|
||||||
const modelList = [
|
const modelList = [
|
||||||
{ label: 'DeepSeek', value: 'deepseek-chat' },
|
{ label: 'DeepSeek', value: 'deepseek-chat' },
|
||||||
|
{ label: 'Gemma-2B', value: 'gemma:2b' },
|
||||||
|
{ label: 'Gemma3', value: 'gemma3:12b' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const outputTypeList = [
|
const outputTypeList = [
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ export default defineComponent({
|
|||||||
|
|
||||||
const filter = ref('');
|
const filter = ref('');
|
||||||
|
|
||||||
|
|
||||||
const importSelectedBooks = () => {
|
const importSelectedBooks = () => {
|
||||||
if (searchResults.value.length === 0) {
|
if (searchResults.value.length === 0) {
|
||||||
$q.notify({
|
$q.notify({
|
||||||
@@ -116,9 +115,8 @@ export default defineComponent({
|
|||||||
// Aggiungi i libri selezionati alla lista dell'utente
|
// Aggiungi i libri selezionati alla lista dell'utente
|
||||||
emit(
|
emit(
|
||||||
'addArrayTitlesToList',
|
'addArrayTitlesToList',
|
||||||
searchResults.value.filter((row) => row.select),
|
searchResults.value.filter((row) => row.select)
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const pagination = reactive({
|
const pagination = reactive({
|
||||||
@@ -197,7 +195,6 @@ export default defineComponent({
|
|||||||
color: 'negative',
|
color: 'negative',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value = 'Errore nella ricerca dei libri';
|
error.value = 'Errore nella ricerca dei libri';
|
||||||
} finally {
|
} finally {
|
||||||
@@ -289,9 +286,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deselectAll() {
|
function deselectAll() {
|
||||||
|
|
||||||
searchResults.value.forEach((row) => (row.select = false));
|
searchResults.value.forEach((row) => (row.select = false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function condividi() {
|
async function condividi() {
|
||||||
const mystr = "❇️ Ecco l'annuncio da condividere !\nPuoi copiarlo oppure inoltrarlo a chi vuoi.\n\nE\' utile pubblicarlo anche nel gruppo Telegram RISO territoriale o in <a href=\'https://t.me/riso_gruppo/1911\'>RISO RIevoluzione SOlidale</a> (Topic \'Annunci RISO\') "
|
const mystr = "❇️ Ecco l'annuncio da condividere !\nPuoi copiarlo oppure inoltrarlo a chi vuoi.\n\nE\' utile pubblicarlo anche nel gruppo Telegram RISO territoriale o in <a href=\'https://riso.app/riso_gruppo\'>☀️💚 RISO - Rete Italiana Scambi Orizzontali</a> (Topic \'Annunci RISO\') "
|
||||||
await tools.sendMsgTelegramCmd($q, t, shared_consts.MsgTeleg.SHARE_TEXT, false, mystr)
|
await tools.sendMsgTelegramCmd($q, t, shared_consts.MsgTeleg.SHARE_TEXT, false, mystr)
|
||||||
|
|
||||||
tools.copyToClip($q, getlinkpage(), true)
|
tools.copyToClip($q, getlinkpage(), true)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { CImgTitle } from '../CImgTitle/index'
|
|||||||
import { CImgPoster } from '@src/components/CImgPoster'
|
import { CImgPoster } from '@src/components/CImgPoster'
|
||||||
import { CTitle } from '@src/components/CTitle/index'
|
import { CTitle } from '@src/components/CTitle/index'
|
||||||
import { CGridOriz } from '@src/components/CGridOriz/index'
|
import { CGridOriz } from '@src/components/CGridOriz/index'
|
||||||
|
import { ChatBot } from '@src/components/ChatBot/index'
|
||||||
import { CCatalogList } from '@src/components/CCatalogList/index'
|
import { CCatalogList } from '@src/components/CCatalogList/index'
|
||||||
import { CRaccoltaCataloghi } from '@src/components/CRaccoltaCataloghi/index'
|
import { CRaccoltaCataloghi } from '@src/components/CRaccoltaCataloghi/index'
|
||||||
import { tools } from '@tools'
|
import { tools } from '@tools'
|
||||||
@@ -80,6 +81,7 @@ export default defineComponent({
|
|||||||
CMapComuni, CMapUsers, CMapGetCoordinates, CMapEditAddressByCoord,
|
CMapComuni, CMapUsers, CMapGetCoordinates, CMapEditAddressByCoord,
|
||||||
CDashGroup, CMovements, CGridOriz, CQRCode, CCatalogList,
|
CDashGroup, CMovements, CGridOriz, CQRCode, CCatalogList,
|
||||||
CSearchProduct, CRaccoltaCataloghi, CPageViewStats,
|
CSearchProduct, CRaccoltaCataloghi, CPageViewStats,
|
||||||
|
ChatBot,
|
||||||
// , //CMapMarker,
|
// , //CMapMarker,
|
||||||
},
|
},
|
||||||
emits: ['selElemClick'],
|
emits: ['selElemClick'],
|
||||||
|
|||||||
@@ -974,6 +974,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<CAITools></CAITools>
|
<CAITools></CAITools>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CHATBOT">
|
||||||
|
<div
|
||||||
|
v-if="editOn"
|
||||||
|
class="elemEdit"
|
||||||
|
>
|
||||||
|
CHATBOT:
|
||||||
|
</div>
|
||||||
|
<ChatBot></ChatBot>
|
||||||
|
</div>
|
||||||
<div v-else-if="myel.type === shared_consts.ELEMTYPE.NOTIFATTOP">
|
<div v-else-if="myel.type === shared_consts.ELEMTYPE.NOTIFATTOP">
|
||||||
<div
|
<div
|
||||||
v-if="editOn"
|
v-if="editOn"
|
||||||
|
|||||||
@@ -160,7 +160,6 @@ export default defineComponent({
|
|||||||
// console.log('load')
|
// console.log('load')
|
||||||
myloadingload.value = true
|
myloadingload.value = true
|
||||||
datastat.value = await globalStore.getStatSite()
|
datastat.value = await globalStore.getStatSite()
|
||||||
datastat.value = {}
|
|
||||||
|
|
||||||
eseguipolling.value = true
|
eseguipolling.value = true
|
||||||
|
|
||||||
|
|||||||
12
src/components/ChatBot/ChatBot.scss
Executable file
12
src/components/ChatBot/ChatBot.scss
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
.chat-container {
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bot {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
45
src/components/ChatBot/ChatBot.ts
Executable file
45
src/components/ChatBot/ChatBot.ts
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
import type { PropType } from 'vue';
|
||||||
|
import { computed, defineComponent, ref } from 'vue';
|
||||||
|
|
||||||
|
import type { IOperators } from '@model';
|
||||||
|
import { tools } from '@tools';
|
||||||
|
|
||||||
|
|
||||||
|
import axios from 'axios'
|
||||||
|
import { useMessageStore, useUserStore } from 'app/src/store';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'ChatBot',
|
||||||
|
props: {},
|
||||||
|
setup(props) {
|
||||||
|
const userMessage = ref<string>('');
|
||||||
|
const messageStore = useMessageStore()
|
||||||
|
const messages = ref<Array<{ sender: string; text: string }>>([]);
|
||||||
|
|
||||||
|
const sendMessage = async () => {
|
||||||
|
if (userMessage.value.trim()) {
|
||||||
|
messages.value.push({ sender: 'user', text: userMessage.value });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await messageStore.chatBot({
|
||||||
|
message: userMessage.value,
|
||||||
|
})
|
||||||
|
const botMessage = response[0]?.text || 'Non ho capito';
|
||||||
|
messages.value.push({ sender: 'bot', text: botMessage });
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Errore nella comunicazione con il backend', error);
|
||||||
|
messages.value.push({ sender: 'bot', text: 'Errore di comunicazione' });
|
||||||
|
}
|
||||||
|
|
||||||
|
userMessage.value = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
tools,
|
||||||
|
userMessage,
|
||||||
|
messages,
|
||||||
|
sendMessage,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
18
src/components/ChatBot/ChatBot.vue
Executable file
18
src/components/ChatBot/ChatBot.vue
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
<template>
|
||||||
|
<q-page>
|
||||||
|
<div class="chat-container">
|
||||||
|
<div v-for="(message, index) in messages" :key="index" :class="message.sender">
|
||||||
|
<p>{{ message.text }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<q-input v-model="userMessage" @keyup.enter="sendMessage" label="Scrivi un messaggio" />
|
||||||
|
</q-page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script lang="ts" src="./ChatBot.ts">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import './ChatBot.scss';
|
||||||
|
</style>
|
||||||
1
src/components/ChatBot/index.ts
Executable file
1
src/components/ChatBot/index.ts
Executable file
@@ -0,0 +1 @@
|
|||||||
|
export {default as ChatBot} from './ChatBot.vue'
|
||||||
@@ -1267,6 +1267,7 @@ const msg_it = {
|
|||||||
isTemplate: 'E\' un modello',
|
isTemplate: 'E\' un modello',
|
||||||
catAI: 'Categorie AI',
|
catAI: 'Categorie AI',
|
||||||
toolsAI: 'Strumenti AI',
|
toolsAI: 'Strumenti AI',
|
||||||
|
CHATBOT: 'Chat BOT',
|
||||||
aitools: 'Ricerca',
|
aitools: 'Ricerca',
|
||||||
queryAI: 'Query AI',
|
queryAI: 'Query AI',
|
||||||
admin_ai: 'Gestione AI',
|
admin_ai: 'Gestione AI',
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia';
|
||||||
import { Api } from '@api'
|
import { Api } from '@api';
|
||||||
|
|
||||||
import { serv_constants } from './Modules/serv_constants'
|
import { serv_constants } from './Modules/serv_constants';
|
||||||
|
|
||||||
import type { IMessage, IMessageState, IMsgUsers} from '../model';
|
import type { IMessage, IMessageState, IMsgUsers } from '../model';
|
||||||
import { StatusMessage } from '../model'
|
import { StatusMessage } from '../model';
|
||||||
import { tools } from '@src/store/Modules/tools'
|
import { tools } from '@src/store/Modules/tools';
|
||||||
import { MsgDefault } from '@src/model'
|
import { MsgDefault } from '@src/model';
|
||||||
import { shared_consts } from '@src/common/shared_vuejs'
|
import { shared_consts } from '@src/common/shared_vuejs';
|
||||||
import { useUserStore } from '@store/UserStore'
|
import { useUserStore } from '@store/UserStore';
|
||||||
|
|
||||||
export const useMessageStore = defineStore('MessageStore', {
|
export const useMessageStore = defineStore('MessageStore', {
|
||||||
state: (): IMessageState => ({
|
state: (): IMessageState => ({
|
||||||
@@ -17,57 +17,57 @@ export const useMessageStore = defineStore('MessageStore', {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
|
|
||||||
getlasts_messages: (mystate: IMessageState) => (): IMessage[] => {
|
getlasts_messages: (mystate: IMessageState) => (): IMessage[] => {
|
||||||
const ctrec = (mystate.last_msgs) ? mystate.last_msgs.slice(0, 5) : []
|
const ctrec = mystate.last_msgs ? mystate.last_msgs.slice(0, 5) : [];
|
||||||
// const ctrec = (mystate.msgs) ? mystate.msgs.slice().reverse().slice(0, 5) : []
|
// const ctrec = (mystate.msgs) ? mystate.msgs.slice().reverse().slice(0, 5) : []
|
||||||
return (ctrec)
|
return ctrec;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getnumMsgUnread: (mystate: IMessageState) => () => {
|
getnumMsgUnread: (mystate: IMessageState) => () => {
|
||||||
return mystate.last_msgs.filter((msg) => !msg.read).length
|
return mystate.last_msgs.filter((msg) => !msg.read).length;
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
setMsg(arrmsg: IMessage[], username: string) {
|
setMsg(arrmsg: IMessage[], username: string) {
|
||||||
// console.log('arrmsg', arrmsg)
|
// console.log('arrmsg', arrmsg)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore();
|
||||||
|
|
||||||
if (arrmsg.length > 0) {
|
if (arrmsg.length > 0) {
|
||||||
let users_msg: any = this.users_msg.find((rec: IMsgUsers) => rec.username === username)
|
let users_msg: any = this.users_msg.find(
|
||||||
|
(rec: IMsgUsers) => rec.username === username
|
||||||
|
);
|
||||||
if (!users_msg) {
|
if (!users_msg) {
|
||||||
this.users_msg.push({ username, msgs: [] })
|
this.users_msg.push({ username, msgs: [] });
|
||||||
users_msg = this.users_msg.find((rec) => rec.username === username)
|
users_msg = this.users_msg.find((rec) => rec.username === username);
|
||||||
}
|
}
|
||||||
users_msg.msgs.push(...arrmsg)
|
users_msg.msgs.push(...arrmsg);
|
||||||
// console.table(users_msg.msgs)
|
// console.table(users_msg.msgs)
|
||||||
|
|
||||||
// users_msg.msgs = tools.getUnique(users_msg.msgs, '_id')
|
// users_msg.msgs = tools.getUnique(users_msg.msgs, '_id')
|
||||||
// console.table(users_msg.msgs)
|
// console.table(users_msg.msgs)
|
||||||
|
|
||||||
if (users_msg.msgs) {
|
if (users_msg.msgs) {
|
||||||
let userother: any = users_msg.msgs.slice(-1)[0].dest
|
let userother: any = users_msg.msgs.slice(-1)[0].dest;
|
||||||
if (userother === userStore.my.username)
|
if (userother === userStore.my.username)
|
||||||
userother = users_msg.msgs.slice(-1)[0].origin
|
userother = users_msg.msgs.slice(-1)[0].origin;
|
||||||
|
|
||||||
let index = this.last_msgs.findIndex((rec: IMessage) => (rec.dest === userother) || (rec.origin === userother))
|
let index = this.last_msgs.findIndex(
|
||||||
|
(rec: IMessage) => rec.dest === userother || rec.origin === userother
|
||||||
|
);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
// Update last message
|
// Update last message
|
||||||
this.last_msgs[index] = users_msg.msgs.slice(-1)[0]
|
this.last_msgs[index] = users_msg.msgs.slice(-1)[0];
|
||||||
} else {
|
} else {
|
||||||
this.last_msgs.push(users_msg.msgs.slice(-1)[0])
|
this.last_msgs.push(users_msg.msgs.slice(-1)[0]);
|
||||||
index = this.last_msgs.findIndex((rec: IMessage) => (rec.dest === userother) || (rec.origin === userother))
|
index = this.last_msgs.findIndex(
|
||||||
|
(rec: IMessage) => rec.dest === userother || rec.origin === userother
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (this.last_msgs[index])
|
if (this.last_msgs[index])
|
||||||
users_msg.lastdataread = this.last_msgs[index].datemsg
|
users_msg.lastdataread = this.last_msgs[index].datemsg;
|
||||||
else
|
else users_msg.lastdataread = tools.getLastDateReadReset();
|
||||||
users_msg.lastdataread = tools.getLastDateReadReset()
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
users_msg.lastdataread = tools.getLastDateReadReset()
|
users_msg.lastdataread = tools.getLastDateReadReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('RICeVUTO', arrmsg, 'lastdataread', users_msg.lastdataread)
|
// console.log('RICeVUTO', arrmsg, 'lastdataread', users_msg.lastdataread)
|
||||||
@@ -75,39 +75,55 @@ export const useMessageStore = defineStore('MessageStore', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateMsgDataFromServer({ username, lastdataread }: { username: string, lastdataread: Date }) {
|
async updateMsgDataFromServer({
|
||||||
|
username,
|
||||||
|
lastdataread,
|
||||||
|
}: {
|
||||||
|
username: string;
|
||||||
|
lastdataread: Date;
|
||||||
|
}) {
|
||||||
// console.log('updateMsgDataFromServer', username, lastdataread)
|
// console.log('updateMsgDataFromServer', username, lastdataread)
|
||||||
|
|
||||||
return Api.SendReq(`/sendmsg/${username}/${lastdataread}/${tools.getEnv('VITE_APP_ID')}`, 'GET', null)
|
return Api.SendReq(
|
||||||
|
`/sendmsg/${username}/${lastdataread}/${tools.getEnv('VITE_APP_ID')}`,
|
||||||
|
'GET',
|
||||||
|
null
|
||||||
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// console.log('res', res)
|
// console.log('res', res)
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
this.setMsg(res.data.arrmsg, username)
|
this.setMsg(res.data.arrmsg, username);
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
return false
|
return false;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error)
|
console.error(error);
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
async SendMsgEvent(msg: IMessage) {
|
async SendMsgEvent(msg: IMessage) {
|
||||||
console.log('SendMsgEvent', msg)
|
console.log('SendMsgEvent', msg);
|
||||||
|
|
||||||
const data: IMessage = { ...MsgDefault, ...msg }
|
const data: IMessage = { ...MsgDefault, ...msg };
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore();
|
||||||
|
|
||||||
data.source!.page = ''
|
data.source!.page = '';
|
||||||
data.idapp = tools.getEnv('VITE_APP_ID')
|
data.idapp = tools.getEnv('VITE_APP_ID');
|
||||||
data.origin = userStore.my.username
|
data.origin = userStore.my.username;
|
||||||
data.datemsg = tools.getDateNow()
|
data.datemsg = tools.getDateNow();
|
||||||
data.status = StatusMessage.WaitingToSend
|
data.status = StatusMessage.WaitingToSend;
|
||||||
// Options
|
// Options
|
||||||
data.typesend = tools.SetBit(data.typesend, shared_consts.MessageOptions.Notify_ByEmail)
|
data.typesend = tools.SetBit(
|
||||||
data.typesend = tools.SetBit(data.typesend, shared_consts.MessageOptions.Notify_ByPushNotification)
|
data.typesend,
|
||||||
|
shared_consts.MessageOptions.Notify_ByEmail
|
||||||
|
);
|
||||||
|
data.typesend = tools.SetBit(
|
||||||
|
data.typesend,
|
||||||
|
shared_consts.MessageOptions.Notify_ByPushNotification
|
||||||
|
);
|
||||||
|
|
||||||
// console.log('DOPO:')
|
// console.log('DOPO:')
|
||||||
// console.table(data)
|
// console.table(data)
|
||||||
@@ -117,21 +133,30 @@ export const useMessageStore = defineStore('MessageStore', {
|
|||||||
// console.log('res', res)
|
// console.log('res', res)
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
if (res.data.code === serv_constants.RIS_CODE_OK) {
|
if (res.data.code === serv_constants.RIS_CODE_OK) {
|
||||||
data._id = res.data.id
|
data._id = res.data.id;
|
||||||
|
|
||||||
const myarr = []
|
const myarr = [];
|
||||||
myarr.push(data)
|
myarr.push(data);
|
||||||
|
|
||||||
this.setMsg(myarr, data.dest)
|
this.setMsg(myarr, data.dest);
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error)
|
console.error(error);
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
},
|
||||||
|
async chatBot(payload: any): Promise<any> {
|
||||||
|
const response = await Api.SendReq('/api/chatbot', 'POST', { payload });
|
||||||
|
|
||||||
|
if (response.status !== 200) {
|
||||||
|
throw new Error('Errore nella risposta del server');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.data; // Supponiamo che il backend ritorni un array di oggetti con id e title
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user