2
0

feat(editor): Add cc & bcc + Deletable credentials

This commit is contained in:
Baptiste Arnaud
2022-02-19 10:58:56 +01:00
parent c5972ec91b
commit b89e9b1b82
12 changed files with 210 additions and 38 deletions

View File

@ -16,7 +16,7 @@ export const useCredentials = ({
)
if (error) onError(error)
return {
credentials: data?.credentials,
credentials: data?.credentials ?? [],
isLoading: !error && !data,
mutate,
}
@ -33,3 +33,14 @@ export const createCredentials = async (
method: 'POST',
body: credentials,
})
export const deleteCredentials = async (
userId: string,
credentialsId: string
) =>
sendRequest<{
credentials: Credentials
}>({
url: `/api/users/${userId}/credentials/${credentialsId}`,
method: 'DELETE',
})

View File

@ -2,7 +2,12 @@ import { sendRequest } from 'utils'
import { stringify } from 'qs'
import useSWR from 'swr'
import { fetcher } from './utils'
import { Variable, VariableForTest, WebhookResponse } from 'models'
import {
SmtpCredentialsData,
Variable,
VariableForTest,
WebhookResponse,
} from 'models'
export const getGoogleSheetsConsentScreenUrl = (
redirectUrl: string,
@ -123,3 +128,13 @@ export const getDeepKeys = (obj: any): string[] => {
}
return keys
}
export const testSmtpConfig = (smtpData: SmtpCredentialsData, to: string) =>
sendRequest({
method: 'POST',
url: '/api/integrations/email/test-config',
body: {
...smtpData,
to,
},
})