oc-template-react-compiler 6.1.0 → 6.1.1
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc-template-react-compiler",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Compiler for the React OC template",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@vitejs/plugin-react": "^4.0.0",
|
|
32
32
|
"oc-template-react": "^4.0.1",
|
|
33
|
-
"oc-vite-compiler": "^3.5.
|
|
33
|
+
"oc-vite-compiler": "^3.5.2",
|
|
34
34
|
"react": "18.2.0",
|
|
35
35
|
"react-dom": "18.2.0"
|
|
36
36
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@testing-library/user-event": "^14.4.3",
|
|
35
35
|
"@types/react": "^18.0.28",
|
|
36
36
|
"jsdom": "^21.1.1",
|
|
37
|
-
"oc-server": "
|
|
38
|
-
"oc-template-react-compiler": "^6.
|
|
37
|
+
"oc-server": "^0.3.0",
|
|
38
|
+
"oc-template-react-compiler": "^6.1.0",
|
|
39
39
|
"react": "18.2.0",
|
|
40
40
|
"react-dom": "18.2.0",
|
|
41
41
|
"typescript": "5.1.3",
|
package/scaffold/src/src/App.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { serverClient, InitialData, ActionOutput } from 'oc-server';
|
|
|
3
3
|
import styles from './styles.css';
|
|
4
4
|
import logo from '../public/logo.png';
|
|
5
5
|
|
|
6
|
-
type AdditionalData = ActionOutput<'
|
|
6
|
+
type AdditionalData = ActionOutput<'funFact'>;
|
|
7
7
|
|
|
8
8
|
const App: React.FC<InitialData> = (props: InitialData) => {
|
|
9
9
|
const { firstName, lastName, born, hobbies } = props;
|
|
@@ -12,10 +12,10 @@ const App: React.FC<InitialData> = (props: InitialData) => {
|
|
|
12
12
|
);
|
|
13
13
|
const [error, setError] = useState('');
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const getFunFact = async () => {
|
|
16
16
|
setError('');
|
|
17
17
|
try {
|
|
18
|
-
const data = await serverClient.
|
|
18
|
+
const data = await serverClient.funFact({ year: born });
|
|
19
19
|
setAdditionalData(data);
|
|
20
20
|
} catch (err) {
|
|
21
21
|
setError(String(err));
|
|
@@ -40,7 +40,7 @@ const App: React.FC<InitialData> = (props: InitialData) => {
|
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
|
42
42
|
{additionalData && <div>{additionalData.funFact}</div>}
|
|
43
|
-
<button className={styles.button} onClick={
|
|
43
|
+
<button className={styles.button} onClick={getFunFact}>
|
|
44
44
|
Fun year fact
|
|
45
45
|
</button>
|
|
46
46
|
</div>
|
|
@@ -34,7 +34,7 @@ export const server = new Server(async (params: { userId: number }) => {
|
|
|
34
34
|
born: user.born,
|
|
35
35
|
hobbies: user.hobbies,
|
|
36
36
|
};
|
|
37
|
-
}).action('
|
|
37
|
+
}).action('funFact', async (params: { year: number }) => {
|
|
38
38
|
const { year } = params;
|
|
39
39
|
const funFact = await getFunFact(year);
|
|
40
40
|
|