diff --git a/constants_api.json b/constants_api.json index cee7a5d..dbf4487 100644 --- a/constants_api.json +++ b/constants_api.json @@ -1,13 +1,13 @@ { "LOGIN": { - "path": "/api/auth/login", + "path": "/api/v1/auth/login", "method": "POST", "expecte_success_status_code": 200, "expected_error_status_code": 401, "default_error_message": "Internal server error" }, "AUTH": { - "path": "/api/auth", + "path": "/api/v1/auth", "sub": { "LOGIN":{ "path": "/login" @@ -15,6 +15,6 @@ } }, "CREATE_TRANSACTION": { - "path": "/api/account/${var1}/transactions/${var2}" + "path": "/api/v1/account/${var1}/transactions/${var2}" } } \ No newline at end of file diff --git a/src/components/CommonNav.tsx b/src/components/CommonNav.tsx index d11c800..5a330a6 100644 --- a/src/components/CommonNav.tsx +++ b/src/components/CommonNav.tsx @@ -96,7 +96,7 @@ const CommonNav: React.FC = ({ const getAccountDetails = async () => { try { - let res = await api.get('/api/user/accounts'); + let res = await api.get('/api/v1/user/accounts'); let items = res?.data; const cleanedData: AccountDataArray[] = items.map((item: any) => ({ @@ -179,7 +179,7 @@ const CommonNav: React.FC = ({ const getUserDetails = async () => { try { - let res = await api.get(`/api/user/details`); + let res = await api.get(`/api/v1/user/details`); const item = res?.data; if (item) { @@ -249,7 +249,7 @@ const CommonNav: React.FC = ({ const handleLogout = async () => { try { - let res = await api.post('/api/auth/logout'); + let res = await api.post('/api/v1/auth/logout'); if (res.status === 200) { sessionStorage.clear(); setOpen(false); diff --git a/src/components/accounts/Account.tsx b/src/components/accounts/Account.tsx index 7ddfe5d..e7406c8 100644 --- a/src/components/accounts/Account.tsx +++ b/src/components/accounts/Account.tsx @@ -82,7 +82,7 @@ const Account = () => { // const getUserDetails = async () => { // try { - // let res = await api.get('/api/user/details') + // let res = await api.get('/api/v1/user/details') // let accountIDData = res?.data?.account?.id // setAccountID(accountIDData) // } catch (error) { @@ -129,7 +129,7 @@ const Account = () => { }; try { - const res = await api.get(`/api/accounts/${userData.account.id}/dashboard`, { params: payload }); + const res = await api.get(`/api/v1/accounts/${userData.account.id}/dashboard`, { params: payload }); console.log("Dashboard Data:", res.data); const cardDataArray = mapApiDataToCards(res.data); setCards(cardDataArray); @@ -157,7 +157,7 @@ const Account = () => { // const getAccountDetails = async () => { // try { - // let res = await api.get('/api/user/accounts') + // let res = await api.get('/api/v1/user/accounts') // let items = res?.data // setAccountsData(items) // } catch (error) { @@ -179,7 +179,7 @@ const Account = () => { email: data.email, role: data.role } - let res = await api.post(`/api/accounts/${data.i_accountName}/invite`, payloadInvite) + let res = await api.post(`/api/v1/accounts/${data.i_accountName}/invite`, payloadInvite) if (res?.data) { toast.success("Invite Sent Successfully...!", { position: "top-center", diff --git a/src/components/accounts/AccountNav.tsx b/src/components/accounts/AccountNav.tsx index a9098f0..6cb2c6a 100644 --- a/src/components/accounts/AccountNav.tsx +++ b/src/components/accounts/AccountNav.tsx @@ -64,7 +64,7 @@ const AccountNav: React.FC = ({ accountName = null, transaction const getAccountDetails = async () => { try { - let res = await api.get('/api/user/accounts'); + let res = await api.get('/api/v1/user/accounts'); let items = res?.data; const cleanedData: AccountDataArray[] = items.map((item: any) => ({ @@ -141,7 +141,7 @@ const AccountNav: React.FC = ({ accountName = null, transaction const getUserDetails = async () => { try { - let res = await api.get(`/api/user/details`); + let res = await api.get(`/api/v1/user/details`); const item = res?.data; if (item) { @@ -214,7 +214,7 @@ const AccountNav: React.FC = ({ accountName = null, transaction const handleLogout = async () => { try { - let res = await api.post('/api/auth/logout'); + let res = await api.post('/api/v1/auth/logout'); if (res.status === 200) { sessionStorage.clear(); setOpen(false); diff --git a/src/components/accounts/Accounts.tsx b/src/components/accounts/Accounts.tsx index a9f2a3b..ddca8a1 100644 --- a/src/components/accounts/Accounts.tsx +++ b/src/components/accounts/Accounts.tsx @@ -39,7 +39,7 @@ const Accounts = () => { const fetchAccounts = async () => { try { - const response = await api("/api/user/accounts"); + const response = await api("/api/v1/user/accounts"); const data: AccountData[] = response.data || []; setAllAccounts(data); } catch (error) { @@ -60,7 +60,7 @@ const Accounts = () => { const payloadAccount = { name: accountName } - let res = await api.post(`/api/user/accounts`, payloadAccount) + let res = await api.post(`/api/v1/user/accounts`, payloadAccount) if (res?.data) { toast.success("Account Add Successfully...!", { position: "top-center", @@ -88,7 +88,7 @@ const Accounts = () => { const handleAction = async (accountId: string, action: 'accept' | 'reject') => { try { - let response = await api.post(`/api/accounts/${accountId}/accept/invite`) + let response = await api.post(`/api/v1/accounts/${accountId}/accept/invite`) if (response.data.status === 202) { toast.success("Login Successful", { position: "top-center", diff --git a/src/components/accounts/TransactionDataTable.tsx b/src/components/accounts/TransactionDataTable.tsx index 06b1364..e04a667 100644 --- a/src/components/accounts/TransactionDataTable.tsx +++ b/src/components/accounts/TransactionDataTable.tsx @@ -52,7 +52,7 @@ const TransactionDataTable = ({ activeAccountId }) => { console.log("fetchTransactions") setLoading(true) try { - const response = await api.get(`/api/accounts/${activeAccountId}/transactions?sortBy=lastModifiedAt desc`); + const response = await api.get(`/api/v1/accounts/${activeAccountId}/transactions?sortBy=lastModifiedAt desc`); setTransactions(response.data || []); } catch (error) { console.error("Error fetching transactions:", error); diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx index 710faac..ebaf489 100644 --- a/src/components/auth/LoginForm.tsx +++ b/src/components/auth/LoginForm.tsx @@ -104,7 +104,7 @@ const LoginForm = ({ onSwitchToRegister }) => { try { const res = await axios.post( - `${import.meta.env.VITE_BASE_URI}/api/auth/login`, + `${import.meta.env.VITE_BASE_URI}/api/v1/auth/login`, { email: formData.email, password: formData.password }, { withCredentials: true, diff --git a/src/components/auth/OAuthGoogle.tsx b/src/components/auth/OAuthGoogle.tsx index 29a4234..bdc5544 100644 --- a/src/components/auth/OAuthGoogle.tsx +++ b/src/components/auth/OAuthGoogle.tsx @@ -28,7 +28,7 @@ const OAuthGoogle: React.FC = ({ isLogin }) => { const token = response.credential; - axios.get(`${import.meta.env.VITE_BASE_URI}/api/oauth2/authorization/google?token=${token}`, { + axios.get(`${import.meta.env.VITE_BASE_URI}/api/v1/oauth2/authorization/google?token=${token}`, { headers: { "ngrok-skip-browser-warning": "69420", } diff --git a/src/components/auth/RegisterForm.tsx b/src/components/auth/RegisterForm.tsx index 5c405d7..beeb675 100644 --- a/src/components/auth/RegisterForm.tsx +++ b/src/components/auth/RegisterForm.tsx @@ -204,7 +204,7 @@ const RegisterForm = ({ onSwitchToLogin }) => { try { const res = await axios.post( - `${import.meta.env.VITE_BASE_URI}/api/auth/signup`, + `${import.meta.env.VITE_BASE_URI}/api/v1/auth/signup`, { firstName: trimmedData.firstName, lastName: trimmedData.lastName, diff --git a/src/components/client/SignDocument.tsx b/src/components/client/SignDocument.tsx index 0532391..c1dfef2 100644 --- a/src/components/client/SignDocument.tsx +++ b/src/components/client/SignDocument.tsx @@ -327,7 +327,7 @@ const SignDocument = () => { }, [saved]) const fetchData = (isSign: boolean = false) => { - axios.get(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}`, + axios.get(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}`, { headers: { "ngrok-skip-browser-warning": "69420", } @@ -436,9 +436,9 @@ const SignDocument = () => { // return; try { dispatch(showLoader("Signing ...")); - await axios.put(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}/tags`, submitData, { headers: { "ngrok-skip-browser-warning": "69420", } }) + await axios.put(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}/tags`, submitData, { headers: { "ngrok-skip-browser-warning": "69420", } }) - const signRes = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}`, {}, { headers: { "ngrok-skip-browser-warning": "69420", } }) + const signRes = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}`, {}, { headers: { "ngrok-skip-browser-warning": "69420", } }) dispatch(hideLoader()); if (signRes.status === 200) { dispatch(hideLoader()); @@ -487,7 +487,7 @@ const SignDocument = () => { const fetchSignatureData = async (signatureId: string) => { try { - const response = await axios.get(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}signatures/${signatureId}`, { + const response = await axios.get(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}signatures/${signatureId}`, { headers: { "ngrok-skip-browser-warning": "69420" } }); if (response.status === 200) { @@ -662,7 +662,7 @@ const SignDocument = () => { const handleDeclineConfirm = async (reason: string, comments: string) => { try { - await axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/decline/${recipientId}`, { reason: reason + ", " + comments }); + await axios.post(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/decline/${recipientId}`, { reason: reason + ", " + comments }); setSignerConsent((prev) => ({ ...prev, decline: true })); setRecSignStatus("DECLINED"); setShowCompletionScreen(true); @@ -670,7 +670,7 @@ const SignDocument = () => { } const handleReassignConfirm = (data: { firstName: string; lastName: string; email: string; message: string }) => { - axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/reassign/${recipientId}`, { + axios.post(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/reassign/${recipientId}`, { name: data.firstName ? data.firstName + " " + data.lastName : data.lastName, email: data.email, message: data.message, diff --git a/src/components/client/TagsCon.tsx b/src/components/client/TagsCon.tsx index 8358e5e..fa33a73 100644 --- a/src/components/client/TagsCon.tsx +++ b/src/components/client/TagsCon.tsx @@ -139,7 +139,7 @@ const TagsCon: React.FC = ({ (async () => { if ("id" in tag) { try { - const response = await api.delete(`/api/sign/${recipientId}/tags/`, { data: [{ tagId: tag.id }] }) + const response = await api.delete(`/api/v1/sign/${recipientId}/tags/`, { data: [{ tagId: tag.id }] }) if (response.status !== 200) throw "Tag Deletion error" } catch (err) { return; @@ -244,7 +244,7 @@ const TagsCon: React.FC = ({ if (saved.save) { if (saved.isDefaultAndClicked) { try { - const res = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}/signatures`, { + const res = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}/signatures`, { signatureId: saved.signatureId, tagId: id }, { headers: { "ngrok-skip-browser-warning": "69420", } }) diff --git a/src/components/client/TermsModal.tsx b/src/components/client/TermsModal.tsx index 94cf420..288c959 100644 --- a/src/components/client/TermsModal.tsx +++ b/src/components/client/TermsModal.tsx @@ -12,7 +12,7 @@ interface TermsModalProps { const TermsModal: React.FC = ({ showTerms, setShowTerms, recipientId }) => { const onAccept = () => { - axios.put(`${import.meta.env.VITE_BASE_URI}/api/sign/accept/${recipientId}`, { headers: { "ngrok-skip-browser-warning": "69420" } }) + axios.put(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/accept/${recipientId}`, { headers: { "ngrok-skip-browser-warning": "69420" } }) .then(response => { setShowTerms(false); console.log(response, "Accept"); @@ -24,7 +24,7 @@ const TermsModal: React.FC = ({ showTerms, setShowTerms, recipi }); }; const onDecline = () => { - axios.put(`${import.meta.env.VITE_BASE_URI}/api/sign/declinerecipientId=${recipientId}`, { headers: { "ngrok-skip-browser-warning": "69420" } }) + axios.put(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/declinerecipientId=${recipientId}`, { headers: { "ngrok-skip-browser-warning": "69420" } }) .then(response => { setShowTerms(false); console.log(response, "Decline"); diff --git a/src/components/contacts/Contacts.tsx b/src/components/contacts/Contacts.tsx index 356f14c..3ea7c5e 100644 --- a/src/components/contacts/Contacts.tsx +++ b/src/components/contacts/Contacts.tsx @@ -29,7 +29,7 @@ const Contacts = () => { const fetchContacts = async () => { setLoading(true) try { - const res = await api.get(`/api/accounts/${activeAccountId}/contacts`); + const res = await api.get(`/api/v1/accounts/${activeAccountId}/contacts`); setContacts(res.data.content || []); } catch (error) { console.error('Failed to fetch contacts:', error); @@ -55,7 +55,7 @@ const Contacts = () => { const handleDelete = async (contactId) => { try { - let res = await api.delete(`/api/accounts/${activeAccountId}/contacts/${contactId}`) + let res = await api.delete(`/api/v1/accounts/${activeAccountId}/contacts/${contactId}`) if (res?.data) { toast.error("Contact delete successfully!", { position: "top-center", @@ -87,9 +87,9 @@ const Contacts = () => { let res; setCreateAndInviteLoader(true); if (type === 'Edit') { - res = await api.put(`/api/accounts/${activeAccountId}/contacts`, [data]) + res = await api.put(`/api/v1/accounts/${activeAccountId}/contacts`, [data]) } else { - res = await api.post(`/api/accounts/${activeAccountId}/contacts`, [data]); + res = await api.post(`/api/v1/accounts/${activeAccountId}/contacts`, [data]); } if (res.status === 200) { toast.success('Contact created successfully!', { diff --git a/src/components/dashboard/SendForSign.tsx b/src/components/dashboard/SendForSign.tsx index c16836b..4606871 100644 --- a/src/components/dashboard/SendForSign.tsx +++ b/src/components/dashboard/SendForSign.tsx @@ -38,7 +38,7 @@ const SendForSign: React.FC = ({ showSideBar }) => { const handleStartSectionClick = (signType: SignTypeEnum) => { - api.post(`/api/accounts/${defaultAccountId}/transactions`) + api.post(`/api/v1/accounts/${defaultAccountId}/transactions`) .then(res => { if (res.status === 200 || res.status === 201) { dispatch(updateTransactionStatus(TRANSACTION_STATUS_ENUMS.TRANSACTION_INITIATED)); diff --git a/src/components/dashboard/SideBar.tsx b/src/components/dashboard/SideBar.tsx index 5664263..26fa86a 100644 --- a/src/components/dashboard/SideBar.tsx +++ b/src/components/dashboard/SideBar.tsx @@ -38,7 +38,7 @@ const SideBar: React.FC = ({ showSideBar, setShowSideBar, isMobile const handleLogoutConfirm = async () => { try { - await axios.post(`${import.meta.env.VITE_BASE_URI}/api/auth/logout`, + await axios.post(`${import.meta.env.VITE_BASE_URI}/api/v1/auth/logout`, {}, { withCredentials: true, diff --git a/src/components/home/Home.tsx b/src/components/home/Home.tsx index cb8a45f..d6fc766 100644 --- a/src/components/home/Home.tsx +++ b/src/components/home/Home.tsx @@ -82,7 +82,7 @@ const Home = () => { }; try { - const res = await api.get(`/api/accounts/${userData.account.id}/dashboard`, { params: payload }); + const res = await api.get(`/api/v1/accounts/${userData.account.id}/dashboard`, { params: payload }); setDashboardData(res.data); const cardDataArray = mapApiDataToCards(res.data); diff --git a/src/components/home/StartNow.tsx b/src/components/home/StartNow.tsx index 08c8536..ad42a55 100644 --- a/src/components/home/StartNow.tsx +++ b/src/components/home/StartNow.tsx @@ -32,7 +32,7 @@ const StartNow = () => { const subject = filesToUpload[0].name ? filesToUpload[0].name : "Untitled" - const transactionRes = await api.post(`/api/accounts/${userData.account?.id}/transactions`, { subject }); + const transactionRes = await api.post(`/api/v1/accounts/${userData.account?.id}/transactions`, { subject }); const transactionId = transactionRes.data.id const formData = new FormData(); diff --git a/src/components/home/StartSection.tsx b/src/components/home/StartSection.tsx index 2fc7d2a..5b90b45 100644 --- a/src/components/home/StartSection.tsx +++ b/src/components/home/StartSection.tsx @@ -61,7 +61,7 @@ const StartSection = () => { const handleStartSectionClick = (link: string) => { // if ("buttonText" in card && card.buttonText === "Start Now") { - // api.post(`/api/accounts/${defaultAccountId}/transactions`) + // api.post(`/api/v1/accounts/${defaultAccountId}/transactions`) // .then(res => { // if (res.status === 200 || res.status === 201) { // dispatch(updateTransactionStatus(TRANSACTION_STATUS_ENUMS.TRANSACTION_INITIATED)); @@ -76,7 +76,7 @@ const StartSection = () => { // useEffect(() => { // try { - // axios.get(`${import.meta.env.VITE_BASE_URI}/api/dashboard`, {"withCredentials": true, "ngrok-skip-browser-warning": "69420"}).then((res) => { + // axios.get(`${import.meta.env.VITE_BASE_URI}/api/v1/dashboard`, {"withCredentials": true, "ngrok-skip-browser-warning": "69420"}).then((res) => { // console.log(res) // }) // } catch (error) { diff --git a/src/components/process/CompletionScreen/DocumentCompletionScreen.tsx b/src/components/process/CompletionScreen/DocumentCompletionScreen.tsx index 3899f5a..23fec71 100644 --- a/src/components/process/CompletionScreen/DocumentCompletionScreen.tsx +++ b/src/components/process/CompletionScreen/DocumentCompletionScreen.tsx @@ -258,9 +258,9 @@ const DocumentSubmissionOptions = () => { // Step 1: Fetch transaction status useEffect(() => { const fetchTransaction = async () => { - // /api/accounts/{accountId}/transactions/{trxId} + // /api/v1/accounts/{accountId}/transactions/{trxId} try { - const res = await api.get(`/api/accounts/${accountId}/transactions/${transactionId}`); + const res = await api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}`); if (res?.data) { setStatus(res?.data?.status); setTransactionData(res?.data) diff --git a/src/components/process/processStepOne/AdvancedOptions.tsx b/src/components/process/processStepOne/AdvancedOptions.tsx index b4dbe9c..b6a510f 100644 --- a/src/components/process/processStepOne/AdvancedOptions.tsx +++ b/src/components/process/processStepOne/AdvancedOptions.tsx @@ -62,7 +62,7 @@ const AdvancedOptions: React.FC = ({ accountId, setShowAdv debugger console.log(changes) - await api.put(`/api/accounts/${accountId}/transactions/${transactionDetails.id}`, { + await api.put(`/api/v1/accounts/${accountId}/transactions/${transactionDetails.id}`, { }) } diff --git a/src/components/process/processStepOne/DocumentCard.tsx b/src/components/process/processStepOne/DocumentCard.tsx index 6e9d057..ac0d19f 100644 --- a/src/components/process/processStepOne/DocumentCard.tsx +++ b/src/components/process/processStepOne/DocumentCard.tsx @@ -40,7 +40,7 @@ const DocumentCard: React.FC = ({ id, name, isCompleted, tran let lastUpdate = 0; const delay = 1000; - const docProgSSE = new EventSource(`http://10.10.1.99:8083/api/progress/${id}`); + const docProgSSE = new EventSource(`http://10.10.1.99:8083/api/v1/progress/${id}`); docProgSSE.addEventListener('progress', (event) => { const jsonData = JSON.parse(event.data); @@ -97,7 +97,7 @@ const DocumentCard: React.FC = ({ id, name, isCompleted, tran console.error("Missing document ID, account ID, or transaction ID"); return; } - const res = await api.delete(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/documents/${docId}`) + const res = await api.delete(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/documents/${docId}`) if (res.status === 202) { dispatch(deleteDocument(docId)); setDocumentDel({ docId: null, isDel: false }); diff --git a/src/components/process/processStepOne/MessageCon.tsx b/src/components/process/processStepOne/MessageCon.tsx index cfb6713..7adde54 100644 --- a/src/components/process/processStepOne/MessageCon.tsx +++ b/src/components/process/processStepOne/MessageCon.tsx @@ -29,7 +29,7 @@ const MessageCon: React.FC = ({ transactionTemplateToggle, a const fetchEmailDetails = async () => { try { - const res = await api.get(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`); + const res = await api.get(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`); if (transactionTemplateToggle === TRANSACTION_TEMPLATE_TOGGLE.TEMPLATES) { setTemplateName(res.data.name) @@ -45,7 +45,7 @@ const MessageCon: React.FC = ({ transactionTemplateToggle, a } const handleMessageSaveClick = async () => { - await api.put(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { + await api.put(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { name: templateName, subject: emailDtls.subject, message: emailDtls.message, status: "CREATED" diff --git a/src/components/process/processStepOne/ProcessStepOne.tsx b/src/components/process/processStepOne/ProcessStepOne.tsx index b07d14b..c61f676 100644 --- a/src/components/process/processStepOne/ProcessStepOne.tsx +++ b/src/components/process/processStepOne/ProcessStepOne.tsx @@ -110,7 +110,7 @@ const ProcessStepOne = () => { useEffect(() => { (async () => { try { - const res = await api.get(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`); + const res = await api.get(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`); setTransactionDetails(res.data) if (transactionTemplateToggle === TRANSACTION_TEMPLATE_TOGGLE.TEMPLATES) { @@ -226,9 +226,9 @@ const ProcessStepOne = () => { order: index, })); - await api.patch(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/documents`, { "documents": documentsData }); + await api.patch(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/documents`, { "documents": documentsData }); - await api.get(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/documents?include_pages=true`).then(res => { + await api.get(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/documents?include_pages=true`).then(res => { if (res.status === 200) { dispatch(setDocuments(res.data)); } @@ -237,7 +237,7 @@ const ProcessStepOne = () => { }); dispatch(showLoader("Processing Message...")); - await api.put(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { + await api.put(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { name: templateName, subject: emailDtls.subject, message: emailDtls.message, status: "CREATED" @@ -312,7 +312,7 @@ const ProcessStepOne = () => { }] try { - const basePath = `/api/accounts/${accountId}/transactions/${transactionId}/recipients`; + const basePath = `/api/v1/accounts/${accountId}/transactions/${transactionId}/recipients`; const res = await api.post(basePath, recipientsDataTemp) recipientId = res.data[0].id; } catch (error) { @@ -336,7 +336,7 @@ const ProcessStepOne = () => { dispatch(showLoader("Processing eSignature...")); (async () => { try { - await api.put(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { status: "SENT" }) + await api.put(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { status: "SENT" }) if(accountId && transactionId) signSessionRedirect(accountId, transactionId, recipientId); dispatch(hideLoader()); } catch (err) { diff --git a/src/components/process/processStepOne/RecipientAddCard.tsx b/src/components/process/processStepOne/RecipientAddCard.tsx index 3aab883..cefc90f 100644 --- a/src/components/process/processStepOne/RecipientAddCard.tsx +++ b/src/components/process/processStepOne/RecipientAddCard.tsx @@ -273,7 +273,7 @@ const RecipientAddCard = ({ transactionTemplateToggle, editRecipient, editCase, if (!hasFetchedInitial) { try { - const res = await api.get(`/api/accounts/${activeAccountId}/contacts?pageSize=10`); + const res = await api.get(`/api/v1/accounts/${activeAccountId}/contacts?pageSize=10`); const contacts = res.data?.content || []; setCachedContacts([...contacts]); setFilteredContacts(contacts); @@ -327,7 +327,7 @@ const RecipientAddCard = ({ transactionTemplateToggle, editRecipient, editCase, setLastQuery(inputValue); api - .get(`/api/accounts/${activeAccountId}/contacts?pageSize=5&${activeField}=${inputValue}`) + .get(`/api/v1/accounts/${activeAccountId}/contacts?pageSize=5&${activeField}=${inputValue}`) .then((res) => { console.log(res, "Printing RES") const fetched = res.data?.content || []; diff --git a/src/components/process/processStepOne/RecipientsCon.tsx b/src/components/process/processStepOne/RecipientsCon.tsx index 690213c..2458948 100644 --- a/src/components/process/processStepOne/RecipientsCon.tsx +++ b/src/components/process/processStepOne/RecipientsCon.tsx @@ -106,7 +106,7 @@ const RecipientsCon: React.FC = ({ transactionTemplateTog }] try { - const basePath = `/api/accounts/${accountId}/transactions/${transactionId}/recipients`; + const basePath = `/api/v1/accounts/${accountId}/transactions/${transactionId}/recipients`; const res = await api.post(basePath, recipientsDataTemp) recipientId = res.data[0].id; } catch (error) { diff --git a/src/components/process/processStepTwo/DocumentContainer.tsx b/src/components/process/processStepTwo/DocumentContainer.tsx index d42d32f..d4f372f 100644 --- a/src/components/process/processStepTwo/DocumentContainer.tsx +++ b/src/components/process/processStepTwo/DocumentContainer.tsx @@ -113,7 +113,7 @@ const DocumentContainer: React.FC = ({ transactionSaving if (fetchedTags.includes(recipient.id)) return false; fetchedTags.push(recipient.id) return true - }).map((recipient) => api.get(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/recipients/${recipient.id}/tags`)); + }).map((recipient) => api.get(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/recipients/${recipient.id}/tags`)); if (!requests.length) return @@ -203,7 +203,7 @@ const DocumentContainer: React.FC = ({ transactionSaving })); return api.put( - `/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/recipients/${recipientId}/tags`, + `/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/recipients/${recipientId}/tags`, updatedTagsWithNavOrder ); }); @@ -241,7 +241,7 @@ const DocumentContainer: React.FC = ({ transactionSaving // return // SENDING Transaction - START if (!save) { - const res = await api.put(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { status: "SENT" }) + const res = await api.put(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { status: "SENT" }) dispatch(hideLoader()) } // SENDING Transaction - END @@ -460,7 +460,7 @@ const DocumentContainer: React.FC = ({ transactionSaving const handleLazyLoad = (docId: string, pageId: string) => { - api.get(`http://10.10.1.99:8083/api/${accountId}/transactions/${transactionId}/documents/${docId}/pages/${pageId}`).then(res => { + api.get(`http://10.10.1.99:8083/api/v1/${accountId}/transactions/${transactionId}/documents/${docId}/pages/${pageId}`).then(res => { console.log(res) }) } @@ -513,7 +513,7 @@ const DocumentContainer: React.FC = ({ transactionSaving draggable="false" width={page.width} height={page.height} - // src={`http://10.10.1.99:8083/api/accounts/${accountId}/transactions/${transactionId}/documents/${doc.id}/pages/${page.id}`} + // src={`http://10.10.1.99:8083/api/v1/accounts/${accountId}/transactions/${transactionId}/documents/${doc.id}/pages/${page.id}`} src={page.src} loading='lazy' /> diff --git a/src/components/process/processStepTwo/DroppedItemsTagsCon.tsx b/src/components/process/processStepTwo/DroppedItemsTagsCon.tsx index db32b33..2d948fb 100644 --- a/src/components/process/processStepTwo/DroppedItemsTagsCon.tsx +++ b/src/components/process/processStepTwo/DroppedItemsTagsCon.tsx @@ -60,7 +60,7 @@ const DroppedItemsTagsCon = forwardRef(({ (async () => { if ("id" in tag) { try { - const response = await api.delete(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/recipients/${recipientId}/tags/${tag.id}`) + const response = await api.delete(`/api/v1/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}/recipients/${recipientId}/tags/${tag.id}`) if (response.status !== 200) throw "Tag Deletion error" } catch (err) { console.error("Tag Deletion error") diff --git a/src/components/process/processStepTwo/FieldList.tsx b/src/components/process/processStepTwo/FieldList.tsx index 6ecc7cb..92f2d37 100644 --- a/src/components/process/processStepTwo/FieldList.tsx +++ b/src/components/process/processStepTwo/FieldList.tsx @@ -120,7 +120,7 @@ const FieldList: React.FC = ({ color, recipientId, recipientIndx useEffect(() => { axios - .get(`${import.meta.env.VITE_BASE_URI}/api/accounts/${accountId}/tags`, { + .get(`${import.meta.env.VITE_BASE_URI}/api/v1/accounts/${accountId}/tags`, { headers: { "ngrok-skip-browser-warning": "69420", } diff --git a/src/components/setting/Setting.tsx b/src/components/setting/Setting.tsx index 176f472..07032a5 100644 --- a/src/components/setting/Setting.tsx +++ b/src/components/setting/Setting.tsx @@ -162,7 +162,7 @@ const Setting = () => { const getAccountList = async () => { setAccountOptionsLoading(true); try { - const res = await api.get('/api/user/accounts'); + const res = await api.get('/api/v1/user/accounts'); if (res?.data) { setAccountOptions(res.data); } @@ -350,7 +350,7 @@ const Setting = () => { const payloadAccount = { name: data.accountName } - res = await api.post(`/api/user/accounts`, payloadAccount) + res = await api.post(`/api/v1/user/accounts`, payloadAccount) if (res.status === 201) { toastMesaage = `${action.toUpperCase()} Created Successfull...!` } @@ -359,7 +359,7 @@ const Setting = () => { email: data.email, role: data.role } - res = await api.post(`/api/accounts/${data.i_accountName}/invite`, payloadInvite) + res = await api.post(`/api/v1/accounts/${data.i_accountName}/invite`, payloadInvite) toastMesaage = "Invite Successfull...!" } @@ -390,7 +390,7 @@ const Setting = () => { const handleContactSubmit = async (data: ContactData) => { try { setCreateAndInviteLoader(true); - const res = await api.post(`/api/accounts/${activeAccountId}/contacts`, [data]); + const res = await api.post(`/api/v1/accounts/${activeAccountId}/contacts`, [data]); if (res.status === 200) { toast.success('Contact created successfully!', { position: "top-center", diff --git a/src/components/setting/Signature/AddSignatureModal.tsx b/src/components/setting/Signature/AddSignatureModal.tsx index 8cbc314..caecc0f 100644 --- a/src/components/setting/Signature/AddSignatureModal.tsx +++ b/src/components/setting/Signature/AddSignatureModal.tsx @@ -235,7 +235,7 @@ const AddSignatureModal: React.FC = ({ ...payload, signatureId: editingSignature.id }; - res = await api.put(`/api/user/signatures`, updatePayload); + res = await api.put(`/api/v1/user/signatures`, updatePayload); // toast.success("Signature Updated Successfully", { // position: "top-center", @@ -250,7 +250,7 @@ const AddSignatureModal: React.FC = ({ // }); } else { // Create new signature - res = await api.post(`/api/user/signatures`, payload); + res = await api.post(`/api/v1/user/signatures`, payload); // toast.success("Signature Created Successfully", { // position: "top-center", @@ -426,7 +426,7 @@ const AddSignatureModal: React.FC = ({ const getUserDetails = async () => { try { - let res = await api.get(`/api/user/details`); + let res = await api.get(`/api/v1/user/details`); let currUser = res?.data; setUser(currUser); diff --git a/src/components/setting/Signature/Signature.tsx b/src/components/setting/Signature/Signature.tsx index c11e04f..9748ab9 100644 --- a/src/components/setting/Signature/Signature.tsx +++ b/src/components/setting/Signature/Signature.tsx @@ -42,7 +42,7 @@ const SignatureManager: React.FC = () => { const getAllSignatures = async () => { setLoading(true) try { - let res = await api.get("/api/user/signatures") + let res = await api.get("/api/v1/user/signatures") let signatureData = res?.data setSignatures(signatureData) } catch (error) { @@ -70,7 +70,7 @@ const SignatureManager: React.FC = () => { if (!id) return; setLoading(true) try { - let res = await api.delete(`/api/user/signatures/${id}`) + let res = await api.delete(`/api/v1/user/signatures/${id}`) // toast.success("Signature Delete Successfull", { // position: "top-center", // autoClose: 500, diff --git a/src/components/signature/ClientSignCon.tsx b/src/components/signature/ClientSignCon.tsx index 915a3b9..4b0be13 100644 --- a/src/components/signature/ClientSignCon.tsx +++ b/src/components/signature/ClientSignCon.tsx @@ -154,7 +154,7 @@ const ClientSignCon: React.FC = ({ // Getting Signatures - START useEffect(() => { (async () => { - const res = await axios.get(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}/signatures`, { + const res = await axios.get(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}/signatures`, { headers: { "ngrok-skip-browser-warning": "69420" } @@ -273,7 +273,7 @@ const ClientSignCon: React.FC = ({ // ...payload, // signatureId: editingSignature.id // }; - // res = await axios.put(`${import.meta.env.VITE_BASE_URI}/api/user/signatures`, updatePayload); + // res = await axios.put(`${import.meta.env.VITE_BASE_URI}/api/v1/user/signatures`, updatePayload); // console.log("handleUpdate", res); // toast.success("Signature Updated Successfully", { @@ -289,7 +289,7 @@ const ClientSignCon: React.FC = ({ // }); // } else { // Create new signature - let res = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}/signatures`, + let res = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}/signatures`, payload, { headers: { @@ -780,7 +780,7 @@ const ClientSignCon: React.FC = ({ }; const getUserDetails = async () => { try { - // let res = await axios.get(`/api/user/details`, { + // let res = await axios.get(`/api/v1/user/details`, { // headers: { // "ngrok-skip-browser-warning": "69420", // } diff --git a/src/components/signature_pad/SignatureCon.tsx b/src/components/signature_pad/SignatureCon.tsx index 5e2bac3..0f62b98 100644 --- a/src/components/signature_pad/SignatureCon.tsx +++ b/src/components/signature_pad/SignatureCon.tsx @@ -14,7 +14,7 @@ interface SignatureConProps { const SignatureCon: React.FC = ({ recipientId, openSign, setOpenSign, savedSignature, setSavedSignature }) => { const handleSaveSignature = (signatureDataUrl: string) => { - axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/${recipientId}/signatures`, + axios.post(`${import.meta.env.VITE_BASE_URI}/api/v1/sign/${recipientId}/signatures`, { signature: signatureDataUrl, initials: signatureDataUrl, diff --git a/src/components/templates/TemplateTable.tsx b/src/components/templates/TemplateTable.tsx index 5eb81b5..7c7af22 100644 --- a/src/components/templates/TemplateTable.tsx +++ b/src/components/templates/TemplateTable.tsx @@ -25,7 +25,7 @@ const TemplateTable = () => { const getAllTemplates = async () => { setLoading(true) try { - let res = await api.get(`/api/accounts/${activeAccountId}/templates?sortBy=lastModifiedAt desc`) + let res = await api.get(`/api/v1/accounts/${activeAccountId}/templates?sortBy=lastModifiedAt desc`) let templateData = res?.data setTemplates(templateData) } catch (error) { @@ -88,7 +88,7 @@ const TemplateTable = () => { enableSignatureIdStamping: item.enableSignatureIdStamping, templateId: item.id, }; - let res = await api.post(`/api/accounts/${activeAccountId}/transactions`, payload) + let res = await api.post(`/api/v1/accounts/${activeAccountId}/transactions`, payload) // /process-step-one/:accountId/:transactionId navigate(`/process-step-one/${activeAccountId}/${res?.data?.id}?useTemplate=true`); diff --git a/src/components/templates/Templates.tsx b/src/components/templates/Templates.tsx index 5e0756e..c941b81 100644 --- a/src/components/templates/Templates.tsx +++ b/src/components/templates/Templates.tsx @@ -32,7 +32,7 @@ const Templates = () => { const handleAddTemplate = async () => { try { - const res = await api.post(`/api/accounts/${activeAccountId}/templates`); + const res = await api.post(`/api/v1/accounts/${activeAccountId}/templates`); navigate(`/process-step-one/${activeAccountId}/template/${res.data.id}`) } catch (error) { console.log(error) diff --git a/src/components/transactions/AuditModal.tsx b/src/components/transactions/AuditModal.tsx index 0e8227f..c29fe16 100644 --- a/src/components/transactions/AuditModal.tsx +++ b/src/components/transactions/AuditModal.tsx @@ -49,8 +49,8 @@ const AuditModal: React.FC = ({ closeModal }) => { const getAuditDetails = async () => { // setLoading(true) try { - let res = await api.get(`/api/accounts/${accountId}/transactions/${transactionId}/audit?lang=${userDetails.language || ''}`) - // let res = await api.get(`/api/accounts/${accountId}/transactions/${transactionId}/audit?lang=hi`) + let res = await api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}/audit?lang=${userDetails.language || ''}`) + // let res = await api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}/audit?lang=hi`) if (res?.status === 200) { // console.log(res?.data?.events) let auditResponse = res?.data?.events diff --git a/src/components/transactions/TransactionView.tsx b/src/components/transactions/TransactionView.tsx index 3a2fe9d..dbc5004 100644 --- a/src/components/transactions/TransactionView.tsx +++ b/src/components/transactions/TransactionView.tsx @@ -82,8 +82,8 @@ const TransactionView = () => { const fetchData = async () => { try { - const [res1, res2] = await Promise.all([api.get(`/api/accounts/${accountId}/transactions/${transactionId}`), - api.get(`/api/accounts/${accountId}/transactions/${transactionId}/recipients`)]) + const [res1, res2] = await Promise.all([api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}`), + api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}/recipients`)]) setTransactionDetails({ transaction: res1.data, recipients: res2.data }); } catch (error) { console.error("Error Gettign Transaction and its Recipient: ", error.message) @@ -96,7 +96,7 @@ const TransactionView = () => { const fetchDocuments = async () => { try { - const res = await api.get(`/api/accounts/${accountId}/transactions/${transactionId}/documents`) + const res = await api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}/documents`) if (res?.status === 200) { let resDoc = res?.data setDocumentsData(resDoc) diff --git a/src/config/api.tsx b/src/config/api.tsx index a87ef6d..fc46c37 100644 --- a/src/config/api.tsx +++ b/src/config/api.tsx @@ -74,7 +74,7 @@ api.interceptors.response.use( if (!isRefreshing) { isRefreshing = true; // Attempt to refresh the token - const refreshResponse = await api.patch("/api/auth/refresh"); + const refreshResponse = await api.patch("/api/v1/auth/refresh"); if (refreshResponse.status === 200) { isRefreshing = false; // Retry the original request diff --git a/src/helper/fetchAPIs.tsx b/src/helper/fetchAPIs.tsx index 36e6556..fa92f54 100644 --- a/src/helper/fetchAPIs.tsx +++ b/src/helper/fetchAPIs.tsx @@ -4,7 +4,7 @@ import { AccountData } from "../utlity/types"; const fetchAccounts = async () => { try { - const response = await api("/api/user/accounts"); + const response = await api("/api/v1/user/accounts"); const data: AccountData[] = response.data || []; // setAllAccounts(data); return data; @@ -16,7 +16,7 @@ const fetchAccounts = async () => { const fetchAccountData = async (accountId: string) => { try { if (!accountId) return null; - const response = await api.get(`/api/accounts/${accountId}`); + const response = await api.get(`/api/v1/accounts/${accountId}`); return response.data; } catch (error) { console.error("Error fetching account data:", error); @@ -27,7 +27,7 @@ const fetchAccountData = async (accountId: string) => { const fetchTransactionData = async (accountId: string, transactionId: string) => { try { if (!accountId || !transactionId) return null; - const response = await api.get(`/api/accounts/${accountId}/transactions/${transactionId}`); + const response = await api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}`); return response.data; } catch (error) { console.error("Error fetching account data:", error); diff --git a/src/store/slices/documentSlice.ts b/src/store/slices/documentSlice.ts index 12bfa04..e05dce2 100644 --- a/src/store/slices/documentSlice.ts +++ b/src/store/slices/documentSlice.ts @@ -65,7 +65,7 @@ export const fetchDocuments = createAsyncThunk< const toggle = state.selectedRecipients.transactionTemplateToggle; const response = await api.get( - `/api/accounts/${accountId}/${toggle}/${transactionId}/documents?include_pages=true` + `/api/v1/accounts/${accountId}/${toggle}/${transactionId}/documents?include_pages=true` ); const data = response.data as Document[]; @@ -131,7 +131,7 @@ export const uploadDocuments = createAsyncThunk< try { const res = await api.post( - `/api/accounts/${accountId}/${toggle}/${transactionId}/documents`, + `/api/v1/accounts/${accountId}/${toggle}/${transactionId}/documents`, file, { headers: { @@ -185,7 +185,7 @@ export const handleMultipleTransactionThunk = createAsyncThunk< const currentFile = formData.getAll("file")[i] as File; dispatch(showLoader(`Creating Transaction ${i + 1} ...`)); - const transactionRes = await api.post(`/api/accounts/${accountId}/transactions`, { "subject": currentFile.name }); + const transactionRes = await api.post(`/api/v1/accounts/${accountId}/transactions`, { "subject": currentFile.name }); const transactionId = transactionRes.data.id dispatch(showLoader('Uploading documents...')); @@ -213,7 +213,7 @@ export const handleMultipleTransactionThunk = createAsyncThunk< try { const res = await api.post( - `/api/accounts/${accountId}/${toggle}/${transactionId}/documents`, + `/api/v1/accounts/${accountId}/${toggle}/${transactionId}/documents`, file, { headers: { diff --git a/src/store/slices/selectedRecipientsSlice.tsx b/src/store/slices/selectedRecipientsSlice.tsx index d1c4358..35647e7 100644 --- a/src/store/slices/selectedRecipientsSlice.tsx +++ b/src/store/slices/selectedRecipientsSlice.tsx @@ -73,7 +73,7 @@ export const addRecipientAsync = createAsyncThunk< const updateRecipientsData = recipientsData.filter(recipient => recipient.id !== null); const createRecipientsData = recipientsData.filter(recipient => recipient.id == null); - const basePath = `/api/accounts/${accountId}/${toggle}/${transactionId}/recipients`; + const basePath = `/api/v1/accounts/${accountId}/${toggle}/${transactionId}/recipients`; const resUpdate = updateRecipientsData.length ? await api.put(basePath, updateRecipientsData) @@ -101,7 +101,7 @@ export const removeRecipientAsync = createAsyncThunk< const state = getState() as { selectedRecipients: SelectedRecipientInt }; const toggle = state.selectedRecipients.transactionTemplateToggle; - const basePath = `/api/accounts/${accountId}/${toggle}/${transactionId}/recipients`; + const basePath = `/api/v1/accounts/${accountId}/${toggle}/${transactionId}/recipients`; // return if (recipientId) { @@ -127,7 +127,7 @@ export const fetchRecipients = createAsyncThunk< const state = getState() as { selectedRecipients: SelectedRecipientInt }; const toggle = state.selectedRecipients.transactionTemplateToggle; - const basePath = `/api/accounts/${accountId}/${toggle}/${transactionId}/recipients`; + const basePath = `/api/v1/accounts/${accountId}/${toggle}/${transactionId}/recipients`; const response = await api.get(basePath); let data = response.data as Recipient[]; diff --git a/src/store/slices/userSlice.ts b/src/store/slices/userSlice.ts index 2673198..d01df7c 100644 --- a/src/store/slices/userSlice.ts +++ b/src/store/slices/userSlice.ts @@ -42,7 +42,7 @@ const initialState: UserState = { export const fetchUserDetails = createAsyncThunk ("user/fetchUserDetails", async (_, { rejectWithValue }) => { try { - const response = await api.get("/api/user/details"); + const response = await api.get("/api/v1/user/details"); return response.data; } catch (error: any) { return rejectWithValue( diff --git a/src/utlity/downloadDocumentsUtils.ts b/src/utlity/downloadDocumentsUtils.ts index 935bf45..1b57185 100644 --- a/src/utlity/downloadDocumentsUtils.ts +++ b/src/utlity/downloadDocumentsUtils.ts @@ -3,7 +3,7 @@ import api from "../config/api"; // Accepts: type = 'archived' | 'combined' | 'certificate' | documentId (number or string) const downloadDocumentUtils = async (accountId: string, transactionId: string, type: string, includeCertificate: string | null = null) => { let documentId = type; - let url = `/api/accounts/${accountId}/transactions/${transactionId}/documents/${documentId}`; + let url = `/api/v1/accounts/${accountId}/transactions/${transactionId}/documents/${documentId}`; if (includeCertificate !== null) { url = url + includeCertificate; } diff --git a/src/utlity/signSessionRedirect.ts b/src/utlity/signSessionRedirect.ts index 861492e..fe6adbb 100644 --- a/src/utlity/signSessionRedirect.ts +++ b/src/utlity/signSessionRedirect.ts @@ -1,7 +1,7 @@ import api from "../config/api"; const signSessionRedirect = async (accountId: string, transactionId: string, recipientId: string) => { - const session = await api.get(`/api/accounts/${accountId}/transactions/${transactionId}/recipients/${recipientId}/create_session`) + const session = await api.get(`/api/v1/accounts/${accountId}/transactions/${transactionId}/recipients/${recipientId}/create_session`) window.location.href = session.data.url; return; }