Skip to content

Commit a636ae0

Browse files
committed
react router skeleton
1 parent 8c7840a commit a636ae0

File tree

8 files changed

+36
-84
lines changed

8 files changed

+36
-84
lines changed

app/electron/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const windowManager = require('electron-window-manager');
1+
22
const electron = require('electron');
33

44
/*
@@ -16,8 +16,6 @@ const {
1616
ipcMain,
1717
} = require('electron');
1818

19-
// ELECTRON WINDOW MANAGER
20-
const windowManager = require('electron-window-manager');
2119

2220

2321
// The splash screen is what appears while the app is loading
@@ -130,7 +128,7 @@ async function createWindow() {
130128
if (isDev) {
131129
win.webContents.once('dom-ready', () => {
132130
debug();
133-
// win.webContents.openDevTools();
131+
win.webContents.openDevTools();
134132
});
135133
}
136134

app/src/Dashboard/Form.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ import React from 'react';
33

44

55
const Form = (props) => {
6-
return (<div className = 'form'>
7-
<h3>Form 1 </h3>
8-
<p>Blah</p>
9-
<p>Blah</p>
10-
<p>Blah</p>
11-
6+
return (
7+
<div className = 'form'>
8+
<h2>{ props.description }</h2>
129
</div>);
13-
}
10+
};
1411

1512
export default Form;

app/src/Dashboard/FormsContainer.jsx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
1-
import React, { useContext } from 'react';
2-
import { Link } from "react-router-dom";
1+
import React, { useContext, useState, useEffect } from 'react';
2+
import { Link } from 'react-router-dom';
33

44
import Form from './Form.jsx';
55

66

77
const FormsContainer = () => {
8+
const [tests, updateTests] = useState([]);
9+
10+
useEffect(() => {
11+
console.log('inside useEffect');
12+
13+
fetch('http://localhost:5000/graphql', {
14+
method: 'POST',
15+
headers: {
16+
'Content-Type': 'application/json',
17+
Accept: 'application/json',
18+
},
19+
body: JSON.stringify({ query: '{readAllTests { description }}' }),
20+
})
21+
.then(res => res.json())
22+
.then((resp) => {
23+
// console.log('resp: ', resp);
24+
const myTests = resp.data.readAllTests;
25+
console.log('myTests: ', myTests);
26+
updateTests(myTests);
27+
})
28+
.catch(err => console.log('error in readAllTests', err));
29+
}, []);
30+
31+
const forms = tests.map((test, index) => <Form key={index} description={test.description} />);
32+
833
return (
934
<div>
1035
<Link to="/">
1136
<button type="button">Go Back</button>
1237
</Link>
13-
<Form/>
38+
{forms}
1439
</div>
1540
);
1641
};

app/src/Dashboard/home.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/src/Dashboard/home.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

server/graphQL/resolvers.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

server/graphQL/resolvers/query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ const { Tests } = require('../../models/reactypeModels');
33
module.exports = {
44
readTest: async (parent, args) => {
55
const resp = await Tests.findOne({ _id: args.id });
6-
if (resp) return { description: args.id };
6+
if (resp) return { description: resp.name };
77
return { description: 'Error reading' };
88
},
99
readAllTests: async () => {
1010
const resp = await Tests.find({});
11-
console.log('resp', resp);
11+
// console.log('resp', resp);
1212
if (resp) {
1313
return resp.map(elem => ({ description: elem.name }));
1414
}

server/graphQL/typedef.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)