@kaspernj/api-maker 1.0.205 → 1.0.206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  ]
17
17
  },
18
18
  "name": "@kaspernj/api-maker",
19
- "version": "1.0.205",
19
+ "version": "1.0.206",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
@@ -8,7 +8,8 @@ export default (WrappedComponent, ModelClass, args = {}) => class modelLoadWrapp
8
8
 
9
9
  state = {
10
10
  model: undefined,
11
- modelId: this.props.match.params[this.paramsVariableName] || this.props.match.params.id
11
+ modelId: this.props.match.params[this.paramsVariableName] || this.props.match.params.id,
12
+ notFound: undefined
12
13
  }
13
14
 
14
15
  componentDidMount() {
@@ -37,7 +38,10 @@ export default (WrappedComponent, ModelClass, args = {}) => class modelLoadWrapp
37
38
 
38
39
  const model = await query.first()
39
40
 
40
- this.setState({model})
41
+ this.setState({
42
+ model,
43
+ notFound: !model
44
+ })
41
45
  }
42
46
 
43
47
  async loadNewModel() {
@@ -62,11 +66,12 @@ export default (WrappedComponent, ModelClass, args = {}) => class modelLoadWrapp
62
66
 
63
67
  render() {
64
68
  const {onUpdated, reloadModel} = digs(this, "onUpdated", "reloadModel")
65
- const {model, modelId} = digs(this.state, "model", "modelId")
69
+ const {model, modelId, notFound} = digs(this.state, "model", "modelId", "notFound")
66
70
  const wrappedComponentProps = {}
67
71
 
68
72
  wrappedComponentProps[this.camelizedLower] = model
69
73
  wrappedComponentProps[`${this.camelizedLower}Id`] = modelId
74
+ wrappedComponentProps[`${this.camelizedLower}NotFound`] = notFound
70
75
 
71
76
  return (
72
77
  <>