fix
This commit is contained in:
@@ -45,7 +45,7 @@ const Main = () => {
|
||||
return (
|
||||
<div className={less["general-content"]}>
|
||||
<div className={less["general-left"]}>
|
||||
{/* {events.map((event) => (
|
||||
{events.map((event) => (
|
||||
<Card className={`${less["card"]} flex flex-row `}>
|
||||
<div className="flex flex-col">
|
||||
<CardHeader className={less["header"]}>
|
||||
@@ -83,7 +83,7 @@ const Main = () => {
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
))} */}
|
||||
))}
|
||||
<Button variant="link" asChild>
|
||||
<Link to={"/dash/admin"}>{t("iorganizer")}</Link>
|
||||
</Button>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
.general{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding-top: 100px;
|
||||
}
|
||||
.left{
|
||||
width: 50%;
|
||||
}
|
||||
.right{
|
||||
|
||||
}
|
||||
@@ -1,9 +1,36 @@
|
||||
import { Input } from "../../ui/input";
|
||||
import VacancyCard from "../../entities/VacancyCard/VacancyCard";
|
||||
import { Textarea } from "../../shared/ui/textarea";
|
||||
import { Button } from "../../shared/ui/button";
|
||||
import less from "./SkillTree.module.less"
|
||||
import { t } from "i18next";
|
||||
import { Switch } from "../../shared/ui/switch";
|
||||
import { addEvent } from "../../widgets/Header/AuthAPI";
|
||||
|
||||
|
||||
const SkillTree = () => {
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div style={{height: '100%'}}>
|
||||
<div className={less["general"]}>
|
||||
<div className={less["left"]}>
|
||||
<form className={less["input-form"]} onSubmit={(event) => addEvent(event)}>
|
||||
<div className={less["novis"]}><Input type="text" name="event_id" placeholder="Event" /></div>
|
||||
<Input type="text" name="title" placeholder="Event name" />
|
||||
<Input type="text" name="description" placeholder="Last name" />
|
||||
<Input type="date" name="start_date" placeholder="Start date" />
|
||||
<Input type="date" name="end_date" placeholder="End date" />
|
||||
<Textarea name="description" placeholder="Description" />
|
||||
<Switch/>
|
||||
<Button>{t("buttonLoginInSystem")}</Button>
|
||||
</form>
|
||||
</div>
|
||||
<div className={less["right"]}>
|
||||
<VacancyCard ></VacancyCard>
|
||||
<VacancyCard ></VacancyCard>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default SkillTree;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FormEvent } from "react";
|
||||
import { API_BASE, API_CREATE_TOKEN, API_USERS } from "../../app/APIurl";
|
||||
import { API_BASE, API_CREATE_TOKEN, API_EVENT, API_USERS } from "../../app/APIurl";
|
||||
|
||||
//логин
|
||||
export const submitLogin = (e: FormEvent<HTMLFormElement>) => {
|
||||
@@ -68,4 +68,38 @@ export const submitRegister = (e: FormEvent<HTMLFormElement>, navigate: Function
|
||||
.catch(error => {
|
||||
console.error('Возникла ошибка с регой:', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//добавление ивента
|
||||
export const addEvent = (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(e.currentTarget);
|
||||
const formProps = Object.fromEntries(formData);
|
||||
console.log(formProps);
|
||||
formProps.tree = JSON.parse('{"name":"John", "age":30, "city":"New York"}');
|
||||
|
||||
fetch(`${API_BASE}${API_EVENT}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(formProps)
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response.status);
|
||||
if (response.ok) {
|
||||
console.log('Создан:', response.headers.get('Location'));
|
||||
return response.json();
|
||||
} else {
|
||||
return response.text().then(errorMessage => {
|
||||
throw new Error('Код ошибки: ' + response.status + '. ' + errorMessage + '. Дата ошибки: ' + response.headers.get('Date'));
|
||||
});
|
||||
}
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Успешно:', data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Возникла ошибка с регой:', error);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user