Skip to content

Commit 4eb27d1

Browse files
dfroehlich-everyonesemperhilarisfago
authored
feat: added customErrorPages option (#75)
* feat: added customErrorPages option * Update README.md Co-authored-by: David Fröhlich <[email protected]> Co-authored-by: Wolfgang Ziegler <[email protected]>
1 parent 948bcf7 commit 4eb27d1

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ You may also take a look at the [example project](https://github.com/drunomics/l
7676
- `axios`: Options to pass-through to the `drupal-ce`
7777
[axios](https://github.com/nuxt-community/axios-module) instance.
7878

79+
- `customErrorPages`: By default, error pages provided by Drupal (e.g. 403, 404 page) are shown,
80+
while keeping the right status code. By enabling customErrorPages, the regular Nuxt error
81+
pages are shown instead, such that the pages can be customized with Nuxt. Defaults to `false`.
82+
7983
## Development
8084

8185
1. Clone this repository

lib/module.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ async function drupalCe (moduleOptions) {
1111
addRequestContentFormat: false,
1212
addVueCompiler: true,
1313
useProxy: 'dev-only',
14-
axios: {}
14+
axios: {},
15+
customErrorPages: false
1516
}
1617

1718
const options = {

lib/plugin.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const storeModule = {
177177
if (error.response) {
178178
// Request made and server responded. If we get a proper Drupal error
179179
// page, apply it and propagate the error code.
180-
if (error.response.data && error.response.data.title && error.response.data.content) {
180+
if (!options.customErrorPages && error.response.data && error.response.data.title && error.response.data.content) {
181181
error.response.data.statusCode = error.response.status
182182
// Set the statusCode for the error
183183
if (process.server && context.res.statusCode) {

0 commit comments

Comments
 (0)