Implement SmartMenuiserie API + added bun test-server
This commit is contained in:
parent
281cd92194
commit
b4806db91a
21 changed files with 377 additions and 244 deletions
62
src/App.tsx
62
src/App.tsx
|
@ -1,10 +1,58 @@
|
|||
import './App.scss'
|
||||
import React from 'react';
|
||||
import './App.scss';
|
||||
import Sidebar from './Components/Sidebar/Sidebar';
|
||||
import { IAvailableContainerModel } from './Interfaces/IAvailableContainerModel';
|
||||
import { IConfigurationResponseModel } from './Interfaces/IConfigurationResponseModel';
|
||||
|
||||
interface IAppProps {
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
interface IAppState {
|
||||
componentOptions: IAvailableContainerModel[]
|
||||
}
|
||||
class App extends React.Component<IAppProps> {
|
||||
public state: IAppState;
|
||||
|
||||
constructor(props: IAppProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
componentOptions: []
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
fetchConfiguration().then((configuration: IConfigurationResponseModel) => {
|
||||
this.setState({
|
||||
componentOptions: configuration.AvailableContainers
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="App">
|
||||
<Sidebar componentOptions={this.state.componentOptions} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchConfiguration(): Promise<IConfigurationResponseModel> {
|
||||
const url = `${import.meta.env.VITE_SMARTMENUISERIE_URL}`;
|
||||
const myHeaders = new Headers({
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
|
||||
const myInit = {
|
||||
method: 'POST',
|
||||
headers: myHeaders
|
||||
};
|
||||
|
||||
return await fetch(url, myInit)
|
||||
.then((response) =>
|
||||
response.json()
|
||||
) as IConfigurationResponseModel;
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue