mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Changed the error handling when klicktipp not accessible.
This commit is contained in:
parent
7b11c2212f
commit
7084bcb9c0
@ -41,7 +41,7 @@ export const getKlickTippUser = async (email: string): Promise<any> => {
|
|||||||
const result = await klicktippConnector.subscriberGet(subscriberId)
|
const result = await klicktippConnector.subscriberGet(subscriberId)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
throw new Error()
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loginKlicktippUser = async (): Promise<boolean> => {
|
export const loginKlicktippUser = async (): Promise<boolean> => {
|
||||||
@ -57,7 +57,7 @@ export const untagUser = async (email: string, tagId: string): Promise<boolean>
|
|||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
return await klicktippConnector.untag(email, tagId)
|
return await klicktippConnector.untag(email, tagId)
|
||||||
}
|
}
|
||||||
throw new Error()
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export const tagUser = async (email: string, tagIds: string): Promise<boolean> => {
|
export const tagUser = async (email: string, tagIds: string): Promise<boolean> => {
|
||||||
@ -65,7 +65,7 @@ export const tagUser = async (email: string, tagIds: string): Promise<boolean> =
|
|||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
return await klicktippConnector.tag(email, tagIds)
|
return await klicktippConnector.tag(email, tagIds)
|
||||||
}
|
}
|
||||||
throw new Error()
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getKlicktippTagMap = async () => {
|
export const getKlicktippTagMap = async () => {
|
||||||
@ -73,5 +73,5 @@ export const getKlicktippTagMap = async () => {
|
|||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
return await klicktippConnector.tagIndex()
|
return await klicktippConnector.tagIndex()
|
||||||
}
|
}
|
||||||
throw new Error()
|
return ''
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ const database = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const klicktipp = {
|
const klicktipp = {
|
||||||
|
KLICKTIPP: process.env.KLICKTIPP === 'true' || false,
|
||||||
KLICKTTIPP_API_URL: process.env.KLICKTIPP_API_URL || 'https://api.klicktipp.com',
|
KLICKTTIPP_API_URL: process.env.KLICKTIPP_API_URL || 'https://api.klicktipp.com',
|
||||||
KLICKTIPP_USER: process.env.KLICKTIPP_USER || 'gradido_test',
|
KLICKTIPP_USER: process.env.KLICKTIPP_USER || 'gradido_test',
|
||||||
KLICKTIPP_PASSWORD: process.env.KLICKTIPP_PASSWORD || 'secret321',
|
KLICKTIPP_PASSWORD: process.env.KLICKTIPP_PASSWORD || 'secret321',
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { MiddlewareFn } from 'type-graphql'
|
import { MiddlewareFn } from 'type-graphql'
|
||||||
import { signIn, getKlickTippUser } from '../apis/KlicktippController'
|
import { signIn, getKlickTippUser } from '../apis/KlicktippController'
|
||||||
import { KlickTipp } from '../graphql/models/KlickTipp'
|
import { KlickTipp } from '../graphql/models/KlickTipp'
|
||||||
|
import CONFIG from '../config/index'
|
||||||
|
|
||||||
export const klicktippRegistrationMiddleware: MiddlewareFn = async (
|
export const klicktippRegistrationMiddleware: MiddlewareFn = async (
|
||||||
// Only for demo
|
// Only for demo
|
||||||
@ -21,8 +22,10 @@ export const klicktippNewsletterStateMiddleware: MiddlewareFn = async (
|
|||||||
next,
|
next,
|
||||||
) => {
|
) => {
|
||||||
const result = await next()
|
const result = await next()
|
||||||
const klickTippUser = await getKlickTippUser(result.email)
|
if (CONFIG.KLICKTIPP) {
|
||||||
const klickTipp = new KlickTipp(klickTippUser)
|
const klickTippUser = await getKlickTippUser(result.email)
|
||||||
result.klickTipp = klickTipp
|
const klickTipp = new KlickTipp(klickTippUser)
|
||||||
|
result.klickTipp = klickTipp
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user