Skip to content

Commit 52ff91e

Browse files
committed
Updates for build issue and gitignore
1 parent 1449b67 commit 52ff91e

File tree

11 files changed

+24
-15
lines changed

11 files changed

+24
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
npm-debug.log*
2323
yarn-debug.log*
2424
yarn-error.log*
25+
.vscode

dist/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package-lock.json

Lines changed: 10 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"url": "git+https://github.com/fetchforms/react-client.git"
2323
},
2424
"dependencies": {
25+
"dotenv": "^16.0.0",
2526
"final-form": "^4.20.4",
2627
"react-final-form": "^6.5.7",
2728
"react-number-format": "^4.9.1"

src/examples/ManagedForm.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ const ManagedForm = () => {
1111
};
1212
return (
1313
<div className=''>
14-
<FetchFormsProvider permission='API_TOKEN'>
14+
<FetchFormsProvider permission={process.env.REACT_APP_FF_TOKEN}>
1515
<div className='text-3xl'>Managed Form</div>
1616
<p className='text-gray-500'>
1717
The easiest way to use Fetch Forms. Pass in a form slug and we'll do
1818
the rest.
1919
</p>
2020
<br />
2121
<div>
22-
<FetchForm slug='FORM_SLUG' onSubmit={onSubmit} />
22+
<FetchForm
23+
slug={process.env.REACT_APP_FF_FORM_ID}
24+
onSubmit={onSubmit}
25+
/>
2326
</div>
2427
</FetchFormsProvider>
2528
</div>

src/examples/hookform/HookForm.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import './styles.css';
1414

1515
const HookForm = () => {
1616
// FetchFormProvider needs to wrap this component
17-
const [fetchForm, loading, error] = useFetchForms('FORM_SLUG');
17+
const [fetchForm, loading, error] = useFetchForms(
18+
process.env.REACT_APP_FF_FORM_ID
19+
);
1820

1921
const onFinish = (values) => {
2022
console.log('Success:', values);
@@ -42,10 +44,10 @@ const HookForm = () => {
4244
};
4345
}
4446
});
45-
console.log('rules', rules);
4647
return rules;
4748
};
4849

50+
// Find the appropriate field type
4951
const findFieldType = (item) => {
5052
switch (item.fieldType) {
5153
case 'select':

src/examples/hookform/Parent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import HookForm from './HookForm';
44

55
const HookParent = () => {
66
return (
7-
<FetchFormsProvider permission='API_TOKEN'>
7+
<FetchFormsProvider permission={process.env.REACT_APP_FF_TOKEN}>
88
<HookForm />
99
</FetchFormsProvider>
1010
);
File renamed without changes.

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import './index.css';
3+
import './examples/index.css';
44
import App from './App';
55

66
ReactDOM.render(<App />, document.getElementById('root'));

src/lib/exports/FetchFormsProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { createContext, useContext, useState } from 'react';
1+
import { createContext, useContext, useState } from 'react';
22

33
export const FormsContext = createContext({});
44

src/lib/exports/hooks/useFetchForms.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const useFetchForms = (id, json) => {
2727
}
2828
);
2929
const temp = await resp.json();
30-
// console.log('form from hook', temp);
3130

3231
if (!temp.success) {
3332
throw (
@@ -74,7 +73,6 @@ const useFetchForms = (id, json) => {
7473
return { success: true };
7574
}
7675
const errorResp = await resp.json();
77-
// console.log('form from hook', temp);
7876
throw (
7977
(errorResp.error && errorResp.error.message) ||
8078
errorResp.error ||

0 commit comments

Comments
 (0)