Context
MahmoudFawzy opened this issue · 2 comments
MahmoudFawzy commented
this my router sample
`
{
route: "/consultation/item/:id",
tag: "consultation-item",
use: function (ctx, next, page) {
$.ajaxsys({
url: "/api/consultations/get/",
data: {
obj: JSON.stringify({
id: ctx.params.id
})
},
success: function (data) {
ctx.user = data;
next();
}
})
}
}
`
Page Js provide context , ctx , I think you must provide this ctx on opts of current component tag: "consultation-item" so I can use my callback data . I try to update your code but I'm not good on type script.
MahmoudFawzy commented
I fix by update "mountRoutes"
I add routeopts.state = req.state; after "routeopts.params = req.params;" line 40
now I has opts.state contain my opts.state.user
crisward commented
I'll close this as it sound like you may have answered your own question.