Commit a8947de1 authored by Pooya Parsa's avatar Pooya Parsa

fix: validate routes

parent 8a8c9151
......@@ -23,15 +23,16 @@
import Item from '../../components/Item.vue'
const camelize = str => str.charAt(0).toUpperCase() + str.slice(1)
const TYPES = ['top', 'new', 'show', 'ask', 'job']
export default {
name: 'item-list',
validate({params: {type, page = 0}}) {
return TYPES.includes(type) && /^[0-9]+$/.test(page)
},
components: {
Item
},
validate({ params }) {
return ['top', 'new', 'show', 'ask', 'job'].includes(params.type)
},
data() {
return {
transition: 'slide-right',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment