diff --git a/backend/src/apis/KlicktippController.ts b/backend/src/apis/KlicktippController.ts index a291bb945..3646b174d 100644 --- a/backend/src/apis/KlicktippController.ts +++ b/backend/src/apis/KlicktippController.ts @@ -15,6 +15,9 @@ export const klicktippSignIn = async ( firstName?: string, lastName?: string, ): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } const fields = { fieldFirstName: firstName, fieldLastName: lastName, @@ -25,12 +28,18 @@ export const klicktippSignIn = async ( } export const signout = async (email: string, language: string): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } const apiKey = language === 'de' ? CONFIG.KLICKTIPP_APIKEY_DE : CONFIG.KLICKTIPP_APIKEY_EN const result = await klicktippConnector.signoff(apiKey, email) return result } export const unsubscribe = async (email: string): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } const isLogin = await loginKlicktippUser() if (isLogin) { return await klicktippConnector.unsubscribe(email) @@ -39,6 +48,9 @@ export const unsubscribe = async (email: string): Promise => { } export const getKlickTippUser = async (email: string): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } const isLogin = await loginKlicktippUser() if (isLogin) { const subscriberId = await klicktippConnector.subscriberSearch(email) @@ -49,14 +61,23 @@ export const getKlickTippUser = async (email: string): Promise => { } export const loginKlicktippUser = async (): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } return await klicktippConnector.login(CONFIG.KLICKTIPP_USER, CONFIG.KLICKTIPP_PASSWORD) } export const logoutKlicktippUser = async (): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } return await klicktippConnector.logout() } export const untagUser = async (email: string, tagId: string): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } const isLogin = await loginKlicktippUser() if (isLogin) { return await klicktippConnector.untag(email, tagId) @@ -65,6 +86,9 @@ export const untagUser = async (email: string, tagId: string): Promise } export const tagUser = async (email: string, tagIds: string): Promise => { + if (!CONFIG.KLICKTIPP) { + return true + } const isLogin = await loginKlicktippUser() if (isLogin) { return await klicktippConnector.tag(email, tagIds) @@ -73,6 +97,9 @@ export const tagUser = async (email: string, tagIds: string): Promise = } export const getKlicktippTagMap = async () => { + if (!CONFIG.KLICKTIPP) { + return '' + } const isLogin = await loginKlicktippUser() if (isLogin) { return await klicktippConnector.tagIndex()