1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-30 11:32:29 +03:00
guide/front/client/entry.client.ts

74 lines
2.0 KiB
TypeScript
Raw Normal View History

import _get from 'lodash/get'
import { createApp } from './app'
const { app, router, store } = createApp()
const STATE_KEY = '__INITIAL_STATE__'
if (window[STATE_KEY]) {
store.replaceState(window[STATE_KEY])
}
router.onReady(() => {
2019-01-04 21:34:16 +03:00
registerBeforeResolve()
app.$mount('#app')
})
Category description add edit (#251) * Migrate routing from prod to new front v 0.5 * migrate category link to new fron v 0.5.5 * migrate category link to new fron v 0.0.8 * migrate category link to new-front caching issue * window bug fix * Category description v 0.0.1 * formatting and unnecessary quote marks deleted * fix originalDescription assignment * Added category description edit/add * Added 409 error handling (need to add functionaly to buttons) * changed: added emit for conflict popup * changed: added api request to conflict handlng * rename Article -> Category, ArticleContent -> CategoryItem * minor rename fix * changed: moved all description changes to a single function, emit call fixes, minor style fixes * changed: category description conflict data sent to api fixes * refactoring bug fix * fix: if description exists no description shown in textarea * fix: empty field in the Dialog * changed: emit event from conflict-dialog refactoring and fix * changed: 400 api error fix * changed: old summary blink bug six * minor fix * hotfix: textare bug fix * api change fix * minor fix * changed: fixed several time description saves failing * Merge with develop - many bugs * merge with develop - critical bug fix * merge with develop bug-fixes * refactoring * bug fixes * changed: replace textarea to markdown in category description. Need to do same with conflict dialog * changed: resolved linter warnings, added markdown to merged window in conflicts dialog * minor fix * cancel, text-wrap fix * minor fix * minor fix * minor fix and uid -> id in addDescription * changed: minor fix 2 * small changes * small refactoring * part of refactoring, btn text bug fix * move no-category description stub to same div where category description is being loaded * move category to own component * minor fixes, enable mobile layout * small change * small changes * slot removed * small changes * throw err moved to else statement * small changes * minor fix * small changes * description button text and icon refactoring * add description btn icon/text small refactoring
2019-02-04 10:57:28 +03:00
function registerBeforeResolve () {
router.beforeEach(async (to, from, next) => {
2019-02-15 14:52:31 +03:00
// This case handles navigation to anchors on same page
if (to.path === from.path) {
next()
return
}
store.commit('tooglePageLoading')
if (!to.matched.length) {
store.commit('tooglePageLoading')
next()
return
}
const propsOption = to.matched[0].props.default
const props = propsOption
? typeof propsOption === 'function'
? propsOption(to)
: typeof propsOption === 'object'
? propsOption
: to.params
: {}
const routeComponent = to.matched[0].components.default
const matchedRootComponent = routeComponent.cid // Check if component already imported
? routeComponent
: (await routeComponent()).default
const matchedComponentsAndChildren = getComponentAndItsChildren(matchedRootComponent)
await Promise.all(matchedComponentsAndChildren.map(component => {
const serverPrefetch = component.options.serverPrefetch && component.options.serverPrefetch[0]
if (typeof serverPrefetch === 'function') {
return serverPrefetch.call({
$store: store,
$router: router,
...props
})
}
}))
store.commit('tooglePageLoading')
next()
})
}
Category description add edit (#251) * Migrate routing from prod to new front v 0.5 * migrate category link to new fron v 0.5.5 * migrate category link to new fron v 0.0.8 * migrate category link to new-front caching issue * window bug fix * Category description v 0.0.1 * formatting and unnecessary quote marks deleted * fix originalDescription assignment * Added category description edit/add * Added 409 error handling (need to add functionaly to buttons) * changed: added emit for conflict popup * changed: added api request to conflict handlng * rename Article -> Category, ArticleContent -> CategoryItem * minor rename fix * changed: moved all description changes to a single function, emit call fixes, minor style fixes * changed: category description conflict data sent to api fixes * refactoring bug fix * fix: if description exists no description shown in textarea * fix: empty field in the Dialog * changed: emit event from conflict-dialog refactoring and fix * changed: 400 api error fix * changed: old summary blink bug six * minor fix * hotfix: textare bug fix * api change fix * minor fix * changed: fixed several time description saves failing * Merge with develop - many bugs * merge with develop - critical bug fix * merge with develop bug-fixes * refactoring * bug fixes * changed: replace textarea to markdown in category description. Need to do same with conflict dialog * changed: resolved linter warnings, added markdown to merged window in conflicts dialog * minor fix * cancel, text-wrap fix * minor fix * minor fix * minor fix and uid -> id in addDescription * changed: minor fix 2 * small changes * small refactoring * part of refactoring, btn text bug fix * move no-category description stub to same div where category description is being loaded * move category to own component * minor fixes, enable mobile layout * small change * small changes * slot removed * small changes * throw err moved to else statement * small changes * minor fix * small changes * description button text and icon refactoring * add description btn icon/text small refactoring
2019-02-04 10:57:28 +03:00
function getComponentAndItsChildren (component, result?) {
if (!result) {
result = []
}
if (!result.includes(component)) {
result.push(component)
}
const children = Object.values(component.options.components)
// Parent component is also presents in components object
.filter(x => x !== component)
children.forEach(x => getComponentAndItsChildren(x, result))
return result
Category description add edit (#251) * Migrate routing from prod to new front v 0.5 * migrate category link to new fron v 0.5.5 * migrate category link to new fron v 0.0.8 * migrate category link to new-front caching issue * window bug fix * Category description v 0.0.1 * formatting and unnecessary quote marks deleted * fix originalDescription assignment * Added category description edit/add * Added 409 error handling (need to add functionaly to buttons) * changed: added emit for conflict popup * changed: added api request to conflict handlng * rename Article -> Category, ArticleContent -> CategoryItem * minor rename fix * changed: moved all description changes to a single function, emit call fixes, minor style fixes * changed: category description conflict data sent to api fixes * refactoring bug fix * fix: if description exists no description shown in textarea * fix: empty field in the Dialog * changed: emit event from conflict-dialog refactoring and fix * changed: 400 api error fix * changed: old summary blink bug six * minor fix * hotfix: textare bug fix * api change fix * minor fix * changed: fixed several time description saves failing * Merge with develop - many bugs * merge with develop - critical bug fix * merge with develop bug-fixes * refactoring * bug fixes * changed: replace textarea to markdown in category description. Need to do same with conflict dialog * changed: resolved linter warnings, added markdown to merged window in conflicts dialog * minor fix * cancel, text-wrap fix * minor fix * minor fix * minor fix and uid -> id in addDescription * changed: minor fix 2 * small changes * small refactoring * part of refactoring, btn text bug fix * move no-category description stub to same div where category description is being loaded * move category to own component * minor fixes, enable mobile layout * small change * small changes * slot removed * small changes * throw err moved to else statement * small changes * minor fix * small changes * description button text and icon refactoring * add description btn icon/text small refactoring
2019-02-04 10:57:28 +03:00
}