feat: update authentication handling and integrate token usage across frontend and backend

This commit is contained in:
Siddhant Rai
2025-03-18 08:29:57 +05:30
parent 4406426515
commit 6583aeff08
19 changed files with 430 additions and 186 deletions

View File

@@ -1,15 +1,20 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import {
selectSourceDocs,
selectSelectedDocs,
selectChunks,
selectPrompt,
} from '../preferences/preferenceSlice';
import conversationService from '../api/services/conversationService';
import Spinner from '../assets/spinner.svg';
import Dropdown from '../components/Dropdown';
import { Doc } from '../models/misc';
import Spinner from '../assets/spinner.svg';
import {
selectChunks,
selectPrompt,
selectSelectedDocs,
selectSourceDocs,
selectToken,
} from '../preferences/preferenceSlice';
import WrapperModal from './WrapperModal';
const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com';
const embeddingsName =
import.meta.env.VITE_EMBEDDINGS_NAME ||
@@ -17,9 +22,6 @@ const embeddingsName =
type StatusType = 'loading' | 'idle' | 'fetched' | 'failed';
import conversationService from '../api/services/conversationService';
import WrapperModal from './WrapperModal';
export const ShareConversationModal = ({
close,
conversationId,
@@ -28,6 +30,7 @@ export const ShareConversationModal = ({
conversationId: string;
}) => {
const { t } = useTranslation();
const token = useSelector(selectToken);
const domain = window.location.origin;
@@ -85,7 +88,7 @@ export const ShareConversationModal = ({
sourcePath && (payload.source = sourcePath.value);
}
conversationService
.shareConversation(isPromptable, payload)
.shareConversation(isPromptable, payload, token)
.then((res) => {
return res.json();
})