2022-05-20 17:08:13 +02:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires, import/no-extraneous-dependencies */
|
2022-02-18 16:34:33 +01:00
|
|
|
const middleware = require('storybook-django/src/middleware');
|
|
|
|
|
2023-02-14 12:17:58 +01:00
|
|
|
// Target the Django server with IPV4 address explicitly to avoid DNS resolution of localhost to IPV6.
|
|
|
|
const origin = process.env.TEST_ORIGIN ?? 'http://127.0.0.1:8000';
|
2022-02-18 16:34:33 +01:00
|
|
|
|
|
|
|
module.exports = middleware.createDjangoAPIMiddleware({
|
|
|
|
origin,
|
2022-02-18 17:07:09 +01:00
|
|
|
// Must match the patterns in urls.py.
|
|
|
|
apiPath: ['/pattern-library/', '/static/wagtailadmin/'],
|
2022-02-18 16:34:33 +01:00
|
|
|
});
|