test request
This commit is contained in:
parent
f7a8c9e077
commit
a401290920
@ -48,6 +48,24 @@ export const Journal = () => {
|
||||
check();
|
||||
}, []);
|
||||
|
||||
const [answer, setAnswer] = useState(null);
|
||||
|
||||
const send = async () => {
|
||||
if (keycloak.authenticated) {
|
||||
keycloak;
|
||||
const rq = await fetch(`${getConfigValue("journal.back.url")}/test`, {
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
authorization: `Bearer ${keycloak.token}`,
|
||||
},
|
||||
});
|
||||
const data = await rq.json();
|
||||
setAnswer(data);
|
||||
} else {
|
||||
setAnswer({ message: 'Пользователь не авторизован' })
|
||||
}
|
||||
}
|
||||
|
||||
const [value, setValue] = useState("");
|
||||
const handleChange = useCallback(
|
||||
(event) => {
|
||||
@ -70,6 +88,10 @@ export const Journal = () => {
|
||||
|
||||
return (
|
||||
<StartWrapper>
|
||||
<IconButton onClick={send} title="Запрос">
|
||||
<ArrowImg src={arrow} />
|
||||
</IconButton>
|
||||
<pre>{JSON.stringify(answer, null, 4)}</pre>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<InputWrapper>
|
||||
<InputLabel htmlFor="input">Название новой лекции:</InputLabel>
|
||||
|
@ -64,12 +64,10 @@ const Input = ({ onStart }) => {
|
||||
}
|
||||
|
||||
export const MainPage = () => {
|
||||
const [shoList, setShoList] = useState(false);
|
||||
|
||||
return (
|
||||
<MainWrapper>
|
||||
{!shoList && <Input onStart={() => setShoList(true)} />}
|
||||
{shoList && <Journal />}
|
||||
{/* {!shoList && <Input onStart={() => setShoList(true)} />} */}
|
||||
<Journal />
|
||||
</MainWrapper>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user