fetch(url, opts)
.then((resp) => {
if (!resp.ok) {
var error = new Error(resp.statusText);
error.status = resp.status;
resp = resp.json().then(json => {
error.data = json;
throw error;
}).catch(() => {
throw error;
})
}
return resp;
})
.then(resp => {
return resp.json()
})
.then(json => {
console.log('use resolve', json)
})
.catch(err => {
console.log(`cathc here => ${err.name} :: ${err.message} :: ${err.status}`)
console.log('cathc here', err)
})
def show
@post = Post.includes(:post_category).find(params[:id])
date = Time.new(params[:year], params[:month], params[:day])
if @post.post_category.seo_url != params[:post_category_id] || @post.publish_date != date
raise ActionController::RoutingError.new('Not Found')
end
end