Sha256: d4895d2f692fe7f5809fd59755db5e7592776884bb35cbffd6ea6dedb795f5b6

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

import Vue from 'vue'
import Router from 'vue-router'

import imageListing from '../components/imageListing.vue'
import imageShow from '../components/imageShow.vue'

import store from '../stores'

Vue.use(Router)

let router = new Router({
  routes: [
    {
      path: '/',
      name: 'root',
      component: imageListing,
      beforeEnter: (to, from, next) => {
        store.dispatch('mediasStore/clearImgListing')
        next()
      }
    },
    {
      path: '/show/:id',
      name: 'showImage',
      component: imageShow,
      beforeEnter: (to, from, next) => {
        store.dispatch('overlayStore/showProgressOverlay', true)
        store.dispatch('mediasStore/fetchSingleImage', to.params.id)
        .then(() => {
          store.dispatch('overlayStore/showProgressOverlay', false)
          next()
        })
        .catch((e) => { console.log(e); store.dispatch('overlayStore/showProgressOverlay', false); })
      }
    },
    {
      path: '/new/',
      name: 'createImage',
      component: imageShow,
      beforeEnter: (to, from, next) => {
        store.dispatch('mediasStore/clearCurrentImg')
        next()
      }
    }
  ]
})

export default router

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_admin_image_manager-0.1.20 app/assets/javascripts/rails_admin_image_manager/router/index.js
rails_admin_image_manager-0.1.15 app/assets/javascripts/rails_admin_image_manager/router/index.js