diff --git a/apps/web/app/api/integration-tenant/[id]/route.ts b/apps/web/app/api/integration-tenant/[id]/route.ts index 5ad00af5f..240d97b26 100644 --- a/apps/web/app/api/integration-tenant/[id]/route.ts +++ b/apps/web/app/api/integration-tenant/[id]/route.ts @@ -12,6 +12,6 @@ export async function DELETE(req: Request, { params }: { params: { id: string } if (id) { const response = await deleteIntegrationTenantRequest(id as string, tenantId, organizationId, access_token); - return $res(response); + return $res(response.data); } } diff --git a/apps/web/app/api/integration-tenant/remember/state/route.ts b/apps/web/app/api/integration-tenant/remember/state/route.ts index a0c6b021c..ea2b65860 100644 --- a/apps/web/app/api/integration-tenant/remember/state/route.ts +++ b/apps/web/app/api/integration-tenant/remember/state/route.ts @@ -19,5 +19,5 @@ export async function GET(req: Request) { access_token ); - return $res(response); + return $res(response.data); } diff --git a/apps/web/app/api/integration/route.ts b/apps/web/app/api/integration/route.ts new file mode 100644 index 000000000..983a3ebcb --- /dev/null +++ b/apps/web/app/api/integration/route.ts @@ -0,0 +1,22 @@ +import { authenticatedGuard } from '@app/services/server/guards/authenticated-guard-app'; +import { getIntegrationRequest } from '@app/services/server/requests/integrations'; +import { NextResponse } from 'next/server'; + +export async function GET(req: Request) { + const res = new NextResponse(); + const { $res, user, access_token, tenantId } = await authenticatedGuard(req, res); + if (!user) return NextResponse.json({}, { status: 401 }); + + const { searchParams } = new URL(req.url); + + const response = await getIntegrationRequest( + { + tenantId: tenantId, + integrationTypeId: searchParams.get('integrationTypeId') as string, + searchQuery: searchParams.get('searchQuery') as string + }, + access_token + ); + + return $res(response.data); +} diff --git a/apps/web/app/api/integration/types/route.ts b/apps/web/app/api/integration/types/route.ts index dc7e8b44f..0fe710ca4 100644 --- a/apps/web/app/api/integration/types/route.ts +++ b/apps/web/app/api/integration/types/route.ts @@ -14,5 +14,5 @@ export async function GET(req: Request) { access_token ); - return $res(response); + return $res(response.data); } diff --git a/apps/web/app/api/organization-team-join/route.ts b/apps/web/app/api/organization-team-join/route.ts index 097d58a53..a887640a7 100644 --- a/apps/web/app/api/organization-team-join/route.ts +++ b/apps/web/app/api/organization-team-join/route.ts @@ -12,10 +12,14 @@ export async function GET(req: Request) { tenantId, organizationId }); + return NextResponse.json(requestToJoinData.data); } export async function POST(req: Request) { const body = (await req.json()) as IRequestToJoinCreate; - return NextResponse.json(await requestToJoinRequest(body)); + + const response = await requestToJoinRequest(body); + + return NextResponse.json(response.data); } diff --git a/apps/web/app/hooks/auth/useAuthenticationPasscode.ts b/apps/web/app/hooks/auth/useAuthenticationPasscode.ts index 66a6d0e25..013904f93 100644 --- a/apps/web/app/hooks/auth/useAuthenticationPasscode.ts +++ b/apps/web/app/hooks/auth/useAuthenticationPasscode.ts @@ -3,11 +3,11 @@ import { authFormValidate } from '@app/helpers/validations'; import { ISigninEmailConfirmWorkspaces } from '@app/interfaces'; import { - sendAuthCodeAPI, - signInEmailAPI, - signInEmailConfirmAPI, - signInWithEmailAndCodeAPI, - signInWorkspaceAPI + sendAuthCodeAPI, + signInEmailAPI, + signInEmailConfirmAPI, + signInWithEmailAndCodeAPI, + signInWorkspaceAPI } from '@app/services/client/api'; import { AxiosError } from 'axios'; import { usePathname, useSearchParams } from 'next/navigation'; @@ -16,292 +16,257 @@ import { useQuery } from '../useQuery'; import { useTranslations } from 'next-intl'; type AuthCodeRef = { - focus: () => void; - clear: () => void; + focus: () => void; + clear: () => void; }; export function useAuthenticationPasscode() { - const pathname = usePathname(); - const query = useSearchParams(); - - const queryTeamId = useMemo(() => { - return query?.get('teamId'); - }, [query]); - const queryEmail = useMemo(() => { - const emailQuery = query?.get('email') || ''; - localStorage?.setItem('ever-teams-start-email', emailQuery); - return emailQuery; - }, [query]); - const queryCode = useMemo(() => { - return query?.get('code'); - }, [query]); - - const t = useTranslations(); - - const loginFromQuery = useRef(false); - const inputCodeRef = useRef(null); - const [screen, setScreen] = useState<'email' | 'passcode' | 'workspace'>( - 'email' - ); - const [workspaces, setWorkspaces] = useState( - [] - ); - const [authenticated, setAuthenticated] = useState(false); - - const [formValues, setFormValues] = useState({ - email: queryEmail, - code: '' - }); - - const [errors, setErrors] = useState({} as { [x: string]: any }); - - // Queries - const { queryCall: sendCodeQueryCall, loading: sendCodeLoading } = useQuery( - sendAuthCodeAPI - ); - - const { - queryCall: signInEmailQueryCall, - loading: signInEmailLoading - } = useQuery(signInEmailAPI); - const { - queryCall: signInEmailConfirmQueryCall, - loading: signInEmailConfirmLoading - } = useQuery(signInEmailConfirmAPI); - const { - queryCall: signInWorkspaceQueryCall, - loading: signInWorkspaceLoading - } = useQuery(signInWorkspaceAPI); - - const { queryCall, loading, infiniteLoading } = useQuery( - signInWithEmailAndCodeAPI - ); - - const handleChange = (e: any) => { - const { name, value } = e.target; - setFormValues((prevState) => ({ ...prevState, [name]: value })); - }; - - /** - * Verify auth request - */ - const verifySignInEmailConfirmRequest = async ({ - email, - code - }: { - email: string; - code: string; - }) => { - signInEmailConfirmQueryCall(email, code) - .then((res) => { - if (res.data?.workspaces && res.data.workspaces.length) { - setWorkspaces(res.data.workspaces); - - setScreen('workspace'); - } - - // If user tries to login from public Team Page as an Already a Member - // Redirect to the current team automatically - if ( - pathname === '/team/[teamId]/[profileLink]' && - res.data.workspaces.length - ) { - if (queryTeamId) { - const currentWorkspace = res.data.workspaces.find((workspace) => - workspace.current_teams - .map((item) => item.team_id) - .includes(queryTeamId as string) - ); - - signInToWorkspaceRequest({ - email: email, - token: currentWorkspace?.token as string, - selectedTeam: queryTeamId as string - }); - } - } - - if (res.data?.status !== 200 && res.data?.status !== 201) { - setErrors({ code: t('pages.auth.INVALID_INVITE_CODE_MESSAGE') }); - } - }) - .catch((err: AxiosError) => { - if (err.response?.status === 400) { - setErrors((err.response?.data as any)?.errors || {}); - } - }); - }; - - const verifyPasscodeRequest = useCallback( - ({ email, code }: { email: string; code: string }) => { - queryCall(email, code) - .then((res) => { - const errors = (res.data as any).errors ?? {}; - - if (errors.email) { - setErrors(errors); - return; - } - - window.location.reload(); - setAuthenticated(true); - }) - .catch((err: AxiosError) => { - if (err.response?.status === 400) { - setErrors((err.response?.data as any)?.errors || {}); - } - - inputCodeRef.current?.clear(); - }); - }, - [queryCall] - ); - const signInToWorkspaceRequest = ({ - email, - token, - selectedTeam - }: { - email: string; - token: string; - selectedTeam: string; - }) => { - signInWorkspaceQueryCall(email, token, selectedTeam) - .then(() => { - window.location.reload(); - setAuthenticated(true); - }) - .catch((err: AxiosError) => { - if (err.response?.status === 400) { - setErrors((err.response?.data as any)?.errors || {}); - } - - inputCodeRef.current?.clear(); - }); - }; - - const handleCodeSubmit = (e: React.FormEvent) => { - e.preventDefault(); - setErrors({}); - const { errors, valid } = authFormValidate( - ['email', 'code'], - formValues as any - ); - - if (!valid) { - setErrors(errors); - return; - } - - infiniteLoading.current = true; - - verifySignInEmailConfirmRequest({ - email: formValues.email, - code: formValues.code - }); - }; - - const handleSubmit = (e: any) => { - e.preventDefault(); - setErrors({}); - const { errors, valid } = authFormValidate( - ['email', 'code'], - formValues as any - ); - - if (!valid) { - setErrors(errors); - return; - } - - infiniteLoading.current = true; - - verifyPasscodeRequest({ - email: formValues.email, - code: formValues.code - }); - }; - - const handleWorkspaceSubmit = ( - e: any, - token: string, - selectedTeam: string - ) => { - e.preventDefault(); - setErrors({}); - const { errors, valid } = authFormValidate(['email'], formValues as any); - - if (!valid) { - setErrors(errors); - return; - } - - infiniteLoading.current = true; - - signInToWorkspaceRequest({ - email: formValues.email, - token, - selectedTeam - }); - }; - - /** - * Verifiy immediatly passcode if email and code were passed from url - */ - useEffect(() => { - if (queryEmail && queryCode && !loginFromQuery.current) { - setScreen('passcode'); - verifyPasscodeRequest({ - email: queryEmail as string, - code: queryCode as string - }); - loginFromQuery.current = true; - } - }, [query, verifyPasscodeRequest, queryEmail, queryCode]); - - /** - * send a fresh auth request handler - * STEP1 - */ - const sendAuthCodeHandler = useCallback(() => { - const promise = signInEmailQueryCall(formValues['email']); - - promise.then(() => setErrors({})); - promise.catch((err: AxiosError) => { - if (err.response?.status === 400) { - setErrors((err.response?.data as any)?.errors || {}); - } - }); - - return promise; - }, [formValues, signInEmailQueryCall]); - - return { - sendAuthCodeHandler, - errors, - sendCodeLoading, - handleSubmit, - handleChange, - loading, - formValues, - setFormValues, - inputCodeRef, - setErrors, - authScreen: { screen, setScreen }, - authenticated, - setAuthenticated, - handleCodeSubmit, - signInEmailQueryCall, - signInEmailLoading, - signInEmailConfirmQueryCall, - signInEmailConfirmLoading, - workspaces, - sendCodeQueryCall, - signInWorkspaceLoading, - queryCall, - handleWorkspaceSubmit - }; + const pathname = usePathname(); + const query = useSearchParams(); + + const queryTeamId = useMemo(() => { + return query?.get('teamId'); + }, [query]); + + const queryEmail = useMemo(() => { + const emailQuery = query?.get('email') || ''; + if (typeof localStorage !== 'undefined') { + localStorage?.setItem('ever-teams-start-email', emailQuery); + } + return emailQuery; + }, [query]); + + const queryCode = useMemo(() => { + return query?.get('code'); + }, [query]); + + const t = useTranslations(); + + const loginFromQuery = useRef(false); + const inputCodeRef = useRef(null); + const [screen, setScreen] = useState<'email' | 'passcode' | 'workspace'>('email'); + const [workspaces, setWorkspaces] = useState([]); + const [authenticated, setAuthenticated] = useState(false); + + const [formValues, setFormValues] = useState({ + email: queryEmail, + code: '' + }); + + const [errors, setErrors] = useState({} as { [x: string]: any }); + + // Queries + const { queryCall: sendCodeQueryCall, loading: sendCodeLoading } = useQuery(sendAuthCodeAPI); + + const { queryCall: signInEmailQueryCall, loading: signInEmailLoading } = useQuery(signInEmailAPI); + const { queryCall: signInEmailConfirmQueryCall, loading: signInEmailConfirmLoading } = + useQuery(signInEmailConfirmAPI); + const { queryCall: signInWorkspaceQueryCall, loading: signInWorkspaceLoading } = useQuery(signInWorkspaceAPI); + + const { queryCall, loading, infiniteLoading } = useQuery(signInWithEmailAndCodeAPI); + + const handleChange = (e: any) => { + const { name, value } = e.target; + setFormValues((prevState) => ({ ...prevState, [name]: value })); + }; + + /** + * Verify auth request + */ + const verifySignInEmailConfirmRequest = async ({ email, code }: { email: string; code: string }) => { + signInEmailConfirmQueryCall(email, code) + .then((res) => { + if (res.data?.workspaces && res.data.workspaces.length) { + setWorkspaces(res.data.workspaces); + + setScreen('workspace'); + } + + // If user tries to login from public Team Page as an Already a Member + // Redirect to the current team automatically + if (pathname === '/team/[teamId]/[profileLink]' && res.data.workspaces.length) { + if (queryTeamId) { + const currentWorkspace = res.data.workspaces.find((workspace) => + workspace.current_teams.map((item) => item.team_id).includes(queryTeamId as string) + ); + + signInToWorkspaceRequest({ + email: email, + token: currentWorkspace?.token as string, + selectedTeam: queryTeamId as string + }); + } + } + + if (res.data?.status !== 200 && res.data?.status !== 201) { + setErrors({ code: t('pages.auth.INVALID_INVITE_CODE_MESSAGE') }); + } + }) + .catch((err: AxiosError) => { + if (err.response?.status === 400) { + setErrors((err.response?.data as any)?.errors || {}); + } + }); + }; + + const verifyPasscodeRequest = useCallback( + ({ email, code }: { email: string; code: string }) => { + queryCall(email, code) + .then((res) => { + const errors = (res.data as any).errors ?? {}; + + if (errors.email) { + setErrors(errors); + return; + } + + window.location.reload(); + setAuthenticated(true); + }) + .catch((err: AxiosError) => { + if (err.response?.status === 400) { + setErrors((err.response?.data as any)?.errors || {}); + } + + inputCodeRef.current?.clear(); + }); + }, + [queryCall] + ); + const signInToWorkspaceRequest = ({ + email, + token, + selectedTeam + }: { + email: string; + token: string; + selectedTeam: string; + }) => { + signInWorkspaceQueryCall(email, token, selectedTeam) + .then(() => { + window.location.reload(); + setAuthenticated(true); + }) + .catch((err: AxiosError) => { + if (err.response?.status === 400) { + setErrors((err.response?.data as any)?.errors || {}); + } + + inputCodeRef.current?.clear(); + }); + }; + + const handleCodeSubmit = (e: React.FormEvent) => { + e.preventDefault(); + setErrors({}); + const { errors, valid } = authFormValidate(['email', 'code'], formValues as any); + + if (!valid) { + setErrors(errors); + return; + } + + infiniteLoading.current = true; + + verifySignInEmailConfirmRequest({ + email: formValues.email, + code: formValues.code + }); + }; + + const handleSubmit = (e: any) => { + e.preventDefault(); + setErrors({}); + const { errors, valid } = authFormValidate(['email', 'code'], formValues as any); + + if (!valid) { + setErrors(errors); + return; + } + + infiniteLoading.current = true; + + verifyPasscodeRequest({ + email: formValues.email, + code: formValues.code + }); + }; + + const handleWorkspaceSubmit = (e: any, token: string, selectedTeam: string) => { + e.preventDefault(); + setErrors({}); + const { errors, valid } = authFormValidate(['email'], formValues as any); + + if (!valid) { + setErrors(errors); + return; + } + + infiniteLoading.current = true; + + signInToWorkspaceRequest({ + email: formValues.email, + token, + selectedTeam + }); + }; + + /** + * Verifiy immediatly passcode if email and code were passed from url + */ + useEffect(() => { + if (queryEmail && queryCode && !loginFromQuery.current) { + setScreen('passcode'); + verifyPasscodeRequest({ + email: queryEmail as string, + code: queryCode as string + }); + loginFromQuery.current = true; + } + }, [query, verifyPasscodeRequest, queryEmail, queryCode]); + + /** + * send a fresh auth request handler + * STEP1 + */ + const sendAuthCodeHandler = useCallback(() => { + const promise = signInEmailQueryCall(formValues['email']); + + promise.then(() => setErrors({})); + promise.catch((err: AxiosError) => { + if (err.response?.status === 400) { + setErrors((err.response?.data as any)?.errors || {}); + } + }); + + return promise; + }, [formValues, signInEmailQueryCall]); + + return { + sendAuthCodeHandler, + errors, + sendCodeLoading, + handleSubmit, + handleChange, + loading, + formValues, + setFormValues, + inputCodeRef, + setErrors, + authScreen: { screen, setScreen }, + authenticated, + setAuthenticated, + handleCodeSubmit, + signInEmailQueryCall, + signInEmailLoading, + signInEmailConfirmQueryCall, + signInEmailConfirmLoading, + workspaces, + sendCodeQueryCall, + signInWorkspaceLoading, + queryCall, + handleWorkspaceSubmit + }; } -export type TAuthenticationPasscode = ReturnType< - typeof useAuthenticationPasscode ->; +export type TAuthenticationPasscode = ReturnType; diff --git a/apps/web/app/hooks/integrations/useIntegration.ts b/apps/web/app/hooks/integrations/useIntegration.ts index 108356676..11caecce7 100644 --- a/apps/web/app/hooks/integrations/useIntegration.ts +++ b/apps/web/app/hooks/integrations/useIntegration.ts @@ -12,9 +12,9 @@ export function useIntegration() { const getIntegration = useCallback( (name: string) => { return queryCall(name).then((response) => { - setIntegration(response.data.data); + setIntegration(response.data); - return response.data.data; + return response.data; }); }, [queryCall, setIntegration] diff --git a/apps/web/app/hooks/integrations/useIntegrationTenant.ts b/apps/web/app/hooks/integrations/useIntegrationTenant.ts index 471512911..851551974 100644 --- a/apps/web/app/hooks/integrations/useIntegrationTenant.ts +++ b/apps/web/app/hooks/integrations/useIntegrationTenant.ts @@ -16,9 +16,9 @@ export function useIntegrationTenant() { const getIntegrationTenant = useCallback( (name: string) => { return queryCall(name).then((response) => { - setIntegrationTenant(response.data.data.items); + setIntegrationTenant(response.data.items); - return response.data.data.items; + return response.data.items; }); }, [queryCall, setIntegrationTenant] diff --git a/apps/web/app/hooks/integrations/useIntegrationTypes.ts b/apps/web/app/hooks/integrations/useIntegrationTypes.ts index 12253a1bb..55d005eb2 100644 --- a/apps/web/app/hooks/integrations/useIntegrationTypes.ts +++ b/apps/web/app/hooks/integrations/useIntegrationTypes.ts @@ -11,9 +11,9 @@ export function useIntegrationTypes() { const getIntegrationTypes = useCallback(() => { return queryCall().then((response) => { - setIntegrationTypes(response.data.data); + setIntegrationTypes(response.data); - return response.data.data; + return response.data; }); }, [queryCall, setIntegrationTypes]); diff --git a/apps/web/app/services/client/api/integrations/index.ts b/apps/web/app/services/client/api/integrations/index.ts index be3eaf20c..ceb8bba1b 100644 --- a/apps/web/app/services/client/api/integrations/index.ts +++ b/apps/web/app/services/client/api/integrations/index.ts @@ -1,8 +1,6 @@ -import { CreateResponse, IIntegration } from '@app/interfaces'; -import api from '../../axios'; +import { IIntegration } from '@app/interfaces'; +import { get } from '../../axios'; export function getIntegrationAPI(integrationTypeId: string, searchQuery = '') { - return api.get>( - `/integration?integrationTypeId=${integrationTypeId}&searchQuery=${searchQuery}` - ); + return get(`/integration?integrationTypeId=${integrationTypeId}&searchQuery=${searchQuery}`); } diff --git a/apps/web/app/services/client/api/integrations/integration-tenant.ts b/apps/web/app/services/client/api/integrations/integration-tenant.ts index c53183704..34150ae48 100644 --- a/apps/web/app/services/client/api/integrations/integration-tenant.ts +++ b/apps/web/app/services/client/api/integrations/integration-tenant.ts @@ -1,12 +1,32 @@ -import { IIntegrationTenant, PaginationResponse, CreateResponse, DeleteResponse } from '@app/interfaces'; -import api from '../../axios'; +import { IIntegrationTenant, PaginationResponse, DeleteResponse } from '@app/interfaces'; +import { deleteApi, get } from '../../axios'; +import { GAUZY_API_BASE_SERVER_URL } from '@app/constants'; +import { getOrganizationIdCookie, getTenantIdCookie } from '@app/helpers'; export function getIntegrationTenantAPI(name: string) { - return api.get>>( - `/integration-tenant/remember/state?name=${name}` - ); + const organizationId = getOrganizationIdCookie(); + const tenantId = getTenantIdCookie(); + + const query = new URLSearchParams({ + 'where[organizationId]': organizationId, + 'where[tenantId]': tenantId, + 'where[name]': name + }); + + const endpoint = GAUZY_API_BASE_SERVER_URL.value + ? `/integration-tenant?${query.toString()}` + : `/integration-tenant/remember/state?name=${name}`; + + return get>(endpoint); } export function deleteIntegrationTenantAPI(integrationId: string) { - return api.delete(`/integration-tenant/${integrationId}`); + const organizationId = getOrganizationIdCookie(); + const tenantId = getTenantIdCookie(); + + const endpoint = GAUZY_API_BASE_SERVER_URL.value + ? `/integration-tenant/${integrationId}?organizationId=${organizationId}&tenantId=${tenantId}` + : `/integration-tenant/${integrationId}`; + + return deleteApi(endpoint); } diff --git a/apps/web/app/services/client/api/integrations/types.ts b/apps/web/app/services/client/api/integrations/types.ts index 5532b170c..041d1a735 100644 --- a/apps/web/app/services/client/api/integrations/types.ts +++ b/apps/web/app/services/client/api/integrations/types.ts @@ -1,6 +1,6 @@ -import { CreateResponse, IIntegrationType } from '@app/interfaces'; -import api from '../../axios'; +import { IIntegrationType } from '@app/interfaces'; +import { get } from '../../axios'; export function getIntegrationTypesAPI() { - return api.get>(`/integration/types`); + return get(`/integration/types`); } diff --git a/apps/web/app/services/client/api/request-to-join-team.ts b/apps/web/app/services/client/api/request-to-join-team.ts index 9a77927f4..a2630e504 100644 --- a/apps/web/app/services/client/api/request-to-join-team.ts +++ b/apps/web/app/services/client/api/request-to-join-team.ts @@ -8,10 +8,24 @@ import { PaginationResponse, IRequestToJoinActionEnum } from '@app/interfaces'; -import api from '../axios'; +import api, { get, post } from '../axios'; +import { getOrganizationIdCookie, getTenantIdCookie } from '@app/helpers'; + +export function getRequestToJoinAPI() { + const organizationId = getOrganizationIdCookie(); + const tenantId = getTenantIdCookie(); + + const query = new URLSearchParams({ + 'where[organizationId]': organizationId, + 'where[tenantId]': tenantId + }); + + return get>(`/organization-team-join?${query.toString()}`); +} export function requestToJoinAPI(data: IRequestToJoinCreate) { - return api.post>('/organization-team-join', data); + const endpoint = '/organization-team-join'; + return post(endpoint, data); } export function validateRequestToJoinAPI(data: IValidateRequestToJoin) { @@ -25,10 +39,6 @@ export function resendCodeRequestToJoinAPI(data: IRequestToJoinCreate) { return api.post>('/organization-team-join/resend-code', data); } -export function getRequestToJoinAPI() { - return api.get>('/organization-team-join'); -} - export function acceptRejectRequestToJoinAPI(id: string, action: IRequestToJoinActionEnum) { return api.put>(`/organization-team-join/${id}/${action}`); } diff --git a/apps/web/app/services/client/axios.ts b/apps/web/app/services/client/axios.ts index 17e524d1c..6c35076ae 100644 --- a/apps/web/app/services/client/axios.ts +++ b/apps/web/app/services/client/axios.ts @@ -103,8 +103,16 @@ function apiConfig(config?: APIConfig) { function get(endpoint: string, config?: APIConfig) { const { baseURL, headers } = apiConfig(config); + const { directAPI = true } = config || {}; + + return baseURL && directAPI ? apiDirect.get(endpoint, { ...config, headers }) : api.get(endpoint); +} + +function deleteApi(endpoint: string, config?: APIConfig) { + const { baseURL, headers } = apiConfig(config); + const { directAPI = true } = config || {}; - return baseURL ? apiDirect.get(endpoint, { ...config, headers }) : api.get(endpoint); + return baseURL && directAPI ? apiDirect.delete(endpoint, { ...config, headers }) : api.delete(endpoint); } function post(url: string, data?: Record | FormData, config?: APIConfig) { @@ -124,6 +132,6 @@ function post(url: string, data?: Record | FormData, config?: AP return baseURL && directAPI ? apiDirect.post(url, data, { ...config, headers }) : api.post(url, data); } -export { get, post }; +export { get, post, deleteApi }; export default api; diff --git a/apps/web/app/services/server/requests/integrations/index.ts b/apps/web/app/services/server/requests/integrations/index.ts index 5849f6296..e55b28354 100644 --- a/apps/web/app/services/server/requests/integrations/index.ts +++ b/apps/web/app/services/server/requests/integrations/index.ts @@ -26,6 +26,7 @@ export function getIntegrationRequest( integrationTypeId }) }); + return serverFetch({ path: `/integration?${query.toString()}`, method: 'GET',