2
0

💚 Add conditional rewrites for NEXTAUTH_URL targets

This commit is contained in:
Baptiste Arnaud
2023-08-06 11:20:13 +02:00
parent fc25734689
commit bd9c8eac4c

View File

@@ -76,19 +76,26 @@ const nextConfig = {
})) }))
) )
: [] : []
).concat([ )
.concat([
{ {
source: '/api/typebots/:typebotId/blocks/:blockId/storage/upload-url', source:
'/api/typebots/:typebotId/blocks/:blockId/storage/upload-url',
destination: destination:
'/api/v1/typebots/:typebotId/blocks/:blockId/storage/upload-url', '/api/v1/typebots/:typebotId/blocks/:blockId/storage/upload-url',
}, },
])
.concat(
process.env.NEXTAUTH_URL
? [
{ {
source: source:
'/api/typebots/:typebotId/blocks/:blockId/steps/:stepId/sampleResult', '/api/typebots/:typebotId/blocks/:blockId/steps/:stepId/sampleResult',
destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/getResultExample`, destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/getResultExample`,
}, },
{ {
source: '/api/typebots/:typebotId/blocks/:blockId/sampleResult', source:
'/api/typebots/:typebotId/blocks/:blockId/sampleResult',
destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/getResultExample`, destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/getResultExample`,
}, },
{ {
@@ -97,7 +104,8 @@ const nextConfig = {
destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/unsubscribe`, destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/unsubscribe`,
}, },
{ {
source: '/api/typebots/:typebotId/blocks/:blockId/unsubscribeWebhook', source:
'/api/typebots/:typebotId/blocks/:blockId/unsubscribeWebhook',
destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/unsubscribe`, destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/unsubscribe`,
}, },
{ {
@@ -106,10 +114,13 @@ const nextConfig = {
destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/subscribe`, destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/subscribe`,
}, },
{ {
source: '/api/typebots/:typebotId/blocks/:blockId/subscribeWebhook', source:
'/api/typebots/:typebotId/blocks/:blockId/subscribeWebhook',
destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/subscribe`, destination: `${process.env.NEXTAUTH_URL}/api/v1/typebots/:typebotId/webhookBlocks/:blockId/subscribe`,
}, },
]), ]
: []
),
} }
}, },
} }