enhancement: implement api client in remaining places

This commit is contained in:
Siddhant Rai
2024-07-24 23:08:42 +05:30
parent 7c6532f145
commit 0c062a8485
7 changed files with 90 additions and 87 deletions

View File

@@ -1,8 +1,9 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import Spinner from '../assets/spinner.svg';
import conversationService from '../api/services/conversationService';
import Exit from '../assets/exit.svg';
const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com';
import Spinner from '../assets/spinner.svg';
export const ShareConversationModal = ({
close,
@@ -25,13 +26,8 @@ export const ShareConversationModal = ({
isPromptable = false,
) => {
setStatus('loading');
fetch(`${apiHost}/api/share?isPromptable=${isPromptable}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ conversation_id: conversationId }),
})
conversationService
.shareConversation(isPromptable, { conversation_id: conversationId })
.then((res) => {
console.log(res.status);
return res.json();