Added config file

This commit is contained in:
Daniel
2022-05-10 21:10:08 +04:30
parent 9a0c383e0b
commit 8e61ef9d99
8 changed files with 62 additions and 8 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
import { useState } from 'react';
import '../styles/Modal.css';
import config from '../config.json';
const AddModal = ({onExit}) => {
const [name, setName] = useState('');
@@ -32,7 +33,8 @@ const AddModal = ({onExit}) => {
}
if(name != '' && isValidHttpUrl(link) && tag != '') {
fetch("/post", {
const address = config.client.api_address + ":" + config.server.port;
fetch(address + "/post", {
// Adding method type
method: "POST",
+4 -2
View File
@@ -1,8 +1,10 @@
import '../styles/List.css';
import config from '../config.json';
const List = ({data}) => {
function deleteEntity(id) {
fetch("/delete", {
const address = config.client.api_address + ":" + config.server.port;
fetch(address + "/delete", {
// Adding method type
method: "DELETE",
@@ -12,7 +14,7 @@ const List = ({data}) => {
// Adding headers to the request
headers: {
"Content-type": "application/json; charset=UTF-8"
"Content-type": "application/json; charset=UTF-8",
}
})
.then(res => res.text())