Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export function navigateToNewsDetail({
- filter,
- id,
- index,
- router,
- search,
- symbolName,
- title,
- }) {
- const params = {
- id,
- index,
- title: toUrlFriendly(title),
- }
- const query = {
- filter,
- search,
- }
- const tag = toUrlFriendlyTag(symbolName)
- if (tag !== 'all') {
- params.tag = tag
- }
- // https://stackoverflow.com/a/52640870/5371505
- return new Promise((resolve, reject) => {
- router
- .push({ name: 'NewsDetail', params, query })
- .then(resolve)
- .catch((error) => {
- if (isNavigationFailure(error, NavigationFailureType.duplicated)) {
- resolve()
- } else {
- reject(error)
- }
- })
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment