fix cors config
This commit is contained in:
parent
6cf11a701d
commit
e0e11fbb19
|
@ -18,7 +18,7 @@ builder.Services.AddControllers(); // TODO: remove magic, specify controllers e
|
|||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddCors(o => o.AddDefaultPolicy(p => p.WithOrigins("*"))); // TODO
|
||||
builder.Services.AddCors(o => o.AddDefaultPolicy(p => p.WithOrigins("*").AllowAnyHeader().AllowAnyMethod()));
|
||||
builder.Services.AddSwaggerGen(config =>
|
||||
{
|
||||
config.SwaggerDoc("v1", new OpenApiInfo{ Title = "My API", Version = "V1" });
|
||||
|
|
|
@ -14,8 +14,6 @@ import { useState } from "react";
|
|||
import en from "./lang/en.json";
|
||||
import de from "./lang/de.json";
|
||||
import NavigationButtons from "./components/NavigationButtons";
|
||||
import LanguageSelect from "./components/LanguageSelect";
|
||||
import LogoutButton from "./components/LogoutButton";
|
||||
|
||||
const App = () => {
|
||||
const { token, setToken, removeToken } = useToken();
|
||||
|
@ -32,8 +30,6 @@ const App = () => {
|
|||
return <Login setToken={setToken} />;
|
||||
}
|
||||
|
||||
console.log("app");
|
||||
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<IntlProvider
|
||||
|
@ -46,8 +42,6 @@ const App = () => {
|
|||
<Grid item xs={3}>
|
||||
<NavigationButtons />
|
||||
<NestedList />
|
||||
<LanguageSelect language={language} setLanguage={setLanguage} />
|
||||
<LogoutButton removeToken={removeToken} />
|
||||
</Grid>
|
||||
<Grid
|
||||
item
|
||||
|
@ -60,7 +54,11 @@ const App = () => {
|
|||
<Divider orientation="vertical" variant="middle" />
|
||||
</Grid>
|
||||
<Grid item xs={8}>
|
||||
<BasicTabs />
|
||||
<BasicTabs
|
||||
removeToken={removeToken}
|
||||
language={language}
|
||||
setLanguage={setLanguage}
|
||||
/>
|
||||
<Routes>
|
||||
<Route
|
||||
path={routes.installationWithId}
|
||||
|
|
|
@ -13,6 +13,7 @@ const LanguageSelect = (props: LanguageSelectProps) => {
|
|||
value={props.language}
|
||||
label="Age"
|
||||
onChange={(e) => props.setLanguage(e.target.value)}
|
||||
sx={{ ml: "auto" }}
|
||||
>
|
||||
<MenuItem value="en">
|
||||
<FormattedMessage id="english" defaultMessage="English" />
|
||||
|
|
|
@ -6,8 +6,15 @@ import { Link } from "react-router-dom";
|
|||
import routes from "../routes.json";
|
||||
import useRouteMatch from "../hooks/useRouteMatch";
|
||||
import { useIntl } from "react-intl";
|
||||
import LogoutButton from "./LogoutButton";
|
||||
import LanguageSelect from "./LanguageSelect";
|
||||
|
||||
const BasicTabs = () => {
|
||||
interface BasicTabsProps {
|
||||
removeToken: () => void;
|
||||
language: string;
|
||||
setLanguage: (language: string) => void;
|
||||
}
|
||||
const BasicTabs = (props: BasicTabsProps) => {
|
||||
const routeMatch = useRouteMatch([
|
||||
routes.installationWithId,
|
||||
routes.alarmsWithId,
|
||||
|
@ -61,6 +68,11 @@ const BasicTabs = () => {
|
|||
component={Link}
|
||||
to={routes.log + id}
|
||||
/>
|
||||
<LanguageSelect
|
||||
language={props.language}
|
||||
setLanguage={props.setLanguage}
|
||||
/>
|
||||
<LogoutButton removeToken={props.removeToken} />
|
||||
</Tabs>
|
||||
</Box>
|
||||
</Box>
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
import { Box, Button, ButtonGroup, Grid, TextField } from "@mui/material";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import { Route, Routes } from "react-router-dom";
|
||||
import NestedList from "../components/NestedList";
|
||||
import BasicTable from "../components/Table";
|
||||
import BasicTabs from "../components/Tabs";
|
||||
import routes from "../routes.json";
|
||||
import InstallationDetail from "./Installation";
|
||||
|
||||
const Home = () => {
|
||||
return (
|
||||
<Box sx={{ padding: 2, bgcolor: "orange.50" }}>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={3}>
|
||||
<ButtonGroup
|
||||
variant="outlined"
|
||||
aria-label="outlined primary button group"
|
||||
sx={{ paddingBottom: 3 }}
|
||||
>
|
||||
<Button>All installations</Button>
|
||||
<Button>Users</Button>
|
||||
</ButtonGroup>
|
||||
<TextField
|
||||
id="outlined-search"
|
||||
label="Search field"
|
||||
type="search"
|
||||
fullWidth
|
||||
/>
|
||||
<NestedList />
|
||||
</Grid>
|
||||
<Grid
|
||||
item
|
||||
xs={1}
|
||||
container
|
||||
direction="row"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
>
|
||||
<Divider orientation="vertical" variant="middle" />
|
||||
</Grid>
|
||||
<Grid item xs={8}>
|
||||
<BasicTabs />
|
||||
<Routes>
|
||||
<Route
|
||||
path={routes.installationWithId}
|
||||
element={<InstallationDetail />}
|
||||
/>
|
||||
<Route path={routes.alarmsWithId} element={<div>alarms</div>} />
|
||||
<Route path={routes.usersWithId} element={<BasicTable />} />
|
||||
<Route path={routes.logWithId} element={<div>log</div>} />
|
||||
</Routes>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
Loading…
Reference in New Issue