edit submission request init

This commit is contained in:
Mateusz Tylka 2023-07-23 11:23:09 +02:00
parent d26a91b65c
commit cfeac6b920
3 changed files with 28 additions and 1 deletions

25
src/api/editSubmission.js Normal file
View File

@ -0,0 +1,25 @@
import KeyCloakService from '../services/KeyCloakService';
import { API } from '../utils/globals';
const editSubmission = (
submisssion,
tags,
description
) => {
// tags = tags.map((tag) => tag.name).join(',');
tags = tags.replaceAll(',', '%2C');
fetch(`${API}/edit-submission/${submisssion}/${tags}/${description}`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
Authorization: `Bearer ${KeyCloakService.getToken()}`,
}
})
.then((resp) => resp.text())
.then((data) => {
console.log(data);
});
};
export default editSubmission;
// http://localhost:3000/api/edit-submission/4/1%2C2/abc

View File

@ -9,6 +9,7 @@ import theme from '../../../utils/theme';
import DeletePopUp from './components/DeletePopUp/DeletePopUp';
import MobileTable from './components/MobileTable/MobileTable';
import Media from 'react-media';
import editSubmission from '../../../api/editSubmission';
const Table = ({
items,
@ -48,7 +49,7 @@ const Table = ({
item={item}
setDeletePopUp={setDeletePopUp}
deletePopUp={deletePopUp}
deleteItem={deleteItem}
deleteItem={() => editSubmission(7355, '1,2,3', 'ssiema siema')}
/>
<TableRowItems orderedKeys={orderedKeys} item={item} i={i} />
<TableRowFooter

View File

@ -111,6 +111,7 @@ const AllEntries = (props) => {
const n = (pageNr - 1) * (ELEMENTS_PER_PAGE * 2);
let elements = entries.slice(n, n + ELEMENTS_PER_PAGE * 2);
console.log(elements);
return (
<FlexColumn