sdnext 0.0.6 → 0.0.7
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/dist/utils/hook.js +4 -2
- package/package.json +1 -1
- package/src/utils/hook.ts +4 -2
package/dist/utils/hook.js
CHANGED
|
@@ -70,10 +70,12 @@ export const ${name}Client = createRequestFn(${hasSchema ? `{
|
|
|
70
70
|
fn: ${name}Action,
|
|
71
71
|
}`})
|
|
72
72
|
|
|
73
|
-
export
|
|
73
|
+
export function ${name}ClientOptional(id?: ${hasSchema ? `${match[1].replace(/Schema$/, "Params").replace(/^./, (char)=>char.toUpperCase())} | ` : ""}undefined) {
|
|
74
|
+
return isNonNullable(id) ? ${name}Client(id) : null
|
|
75
|
+
}
|
|
74
76
|
|
|
75
77
|
export const use${upName} = createUseQuery({
|
|
76
|
-
queryFn: ${name}
|
|
78
|
+
queryFn: ${name}ClientOptional,
|
|
77
79
|
queryKey: "${key}",
|
|
78
80
|
})
|
|
79
81
|
`;
|
package/package.json
CHANGED
package/src/utils/hook.ts
CHANGED
|
@@ -103,10 +103,12 @@ export const ${name}Client = createRequestFn(${
|
|
|
103
103
|
}`
|
|
104
104
|
})
|
|
105
105
|
|
|
106
|
-
export
|
|
106
|
+
export function ${name}ClientOptional(id?: ${hasSchema ? `${match[1].replace(/Schema$/, "Params").replace(/^./, char => char.toUpperCase())} | ` : ""}undefined) {
|
|
107
|
+
return isNonNullable(id) ? ${name}Client(id) : null
|
|
108
|
+
}
|
|
107
109
|
|
|
108
110
|
export const use${upName} = createUseQuery({
|
|
109
|
-
queryFn: ${name}
|
|
111
|
+
queryFn: ${name}ClientOptional,
|
|
110
112
|
queryKey: "${key}",
|
|
111
113
|
})
|
|
112
114
|
`
|