-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: callbacks onLocaleChange and beforeLocaleChange was replaced by hooks
- Loading branch information
Showing
14 changed files
with
76 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Hooks | ||
You can use hooks to extend default behavior or override data. | ||
|
||
## Available hooks | ||
|
||
### Before context is setup by router middleware | ||
|
||
```js | ||
$nuxt.$typo3.hook('context', (context, response) => {}) | ||
``` | ||
|
||
### Before redirect in router middleware | ||
```js | ||
$nuxt.$typo3.hook('redirect', (context, redirectData) => {}) | ||
``` | ||
|
||
### Before locale change | ||
```js | ||
$nuxt.$typo3.hook('beforeLocaleChange', (newLocale, oldLocale) => {}) | ||
``` | ||
|
||
### On locale change | ||
```js | ||
$nuxt.$typo3.hook('localeChange', (newLocale, oldLocale) => {}) | ||
``` | ||
|
||
### Before initialData is setup in the store | ||
```js | ||
$nuxt.$typo3.hook('initialData', (response) => {}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default ({ app }) => { | ||
app.$typo3.hook('beforeRedirect', (context, data) => { | ||
data.redirectUrl = '/' | ||
return data | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
export default ({ app }) => { | ||
app.i18n.locale = app.$typo3.i18n.locale | ||
|
||
app.$typo3.i18n.onLocaleChange = (oldLocale, newLocale) => { | ||
app.$typo3.hook('onLocaleChange', (newLocale, oldLocale) => { | ||
app.i18n.locale = newLocale | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters