-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
32 lines (28 loc) · 835 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import Amplify from 'aws-amplify';
// Amplify init
let config = { aws_project_region: undefined };
async function fetchConfig(url = 'aws-export.json') {
if (!config.aws_project_region) {
try {
const response = await fetch(url);
config = await response.json();
console.debug('(Loading config.json) config.json content = ', config);
return config;
} catch (e) {
console.error(`error loading json ${e}`);
}
} else {
return config;
}
}
console.log(`getConfig`);
fetchConfig().then((config) => {
Amplify.configure(config);
ReactDOM.render(<App />, document.getElementById('root'));
});
registerServiceWorker();