This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
335 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import thaliaAPI from "../API/thaliaAPI"; | ||
|
||
export const createRight = async (rightDetails) => { | ||
try { | ||
const response = await thaliaAPI.post("/admin/rights", rightDetails, { withCredentials: true }); | ||
return response.data; | ||
} catch (error) { | ||
return error; | ||
} | ||
} | ||
export const updateRight = async (rightDetails, rightId) => { | ||
try { | ||
const response = await thaliaAPI.put(`/admin/rights/${rightId}`, rightDetails, { withCredentials: true }); | ||
return response.data; | ||
} catch (error) { | ||
return error; | ||
} | ||
} | ||
export const getRight = async () => { | ||
try { | ||
const response = await thaliaAPI.get('/admin/rights', {}, { withCredentials: true }); | ||
return response.data; | ||
} catch (error) { | ||
return error; | ||
} | ||
} | ||
export const getDelete = async (rightId) => { | ||
try { | ||
const response = await thaliaAPI.delete(`/admin/rights/${rightId}`, {}, { withCredentials: true }); | ||
return response.data; | ||
} catch (error) { | ||
return error; | ||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { useState } from "react"; | ||
import { Modal } from "flowbite-react"; | ||
|
||
function AddBody({ openModal, setOpenModal }) { | ||
const [formData, setFormData] = useState({ | ||
body_name: "", | ||
body_desc: "", | ||
}); | ||
const handleChange = (e) => { | ||
const { name, value } = e.target; | ||
setFormData({ | ||
...formData, | ||
[name]: value, | ||
}); | ||
}; | ||
return ( | ||
<> | ||
<Modal show={openModal} onClose={() => setOpenModal(false)}> | ||
<Modal.Header className="bg-gray-800"> | ||
<h1 className="text-white font-bold">Add New Topic</h1> | ||
</Modal.Header> | ||
<Modal.Body className="ring-1 bg-background rounded-b-md px-2 py-2"> | ||
<div className="w-full"> | ||
<label htmlFor=""> | ||
<h1 className="text-white py-2">Name of the Topic</h1> | ||
<input | ||
type="text" | ||
className="w-full rounded-md bg-gray-700 text-text" | ||
value={formData.body_name} | ||
onChange={handleChange} | ||
name="body_name" | ||
/> | ||
</label> | ||
</div> | ||
<div className="w-full mt-3"> | ||
<label htmlFor=""> | ||
<h1 className="text-text py-2">Provide the Topic Description</h1> | ||
<textarea | ||
name="body_desc" | ||
value={formData.body_desc} | ||
onChange={handleChange} | ||
id="" | ||
rows={8} | ||
className="w-full rounded-md bg-gray-700 text-white" | ||
></textarea> | ||
</label> | ||
</div> | ||
<button className="text-primary border-2 px-2 py-2 rounded-md float-end"> | ||
Add Topic | ||
</button> | ||
</Modal.Body> | ||
</Modal> | ||
</> | ||
); | ||
} | ||
export default AddBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { useState, useEffect } from "react"; | ||
import { Modal } from "flowbite-react"; | ||
|
||
function EditBody({ bodyDetails, openModal, setOpenModal }) { | ||
const [formData, setFormData] = useState({ | ||
body_name: "", | ||
body_desc: "", | ||
}); | ||
useEffect(() => { | ||
if (bodyDetails) { | ||
// eslint-disable-next-line react/prop-types | ||
formData.body_name = bodyDetails?.name; | ||
// eslint-disable-next-line react/prop-types | ||
formData.body_desc = bodyDetails?.description; | ||
} | ||
}, [formData, bodyDetails]); | ||
const handleChange = (e) => { | ||
const { name, value } = e.target; | ||
setFormData({ | ||
...formData, | ||
[name]: value, | ||
}); | ||
}; | ||
return ( | ||
<> | ||
<Modal show={openModal} onClose={() => setOpenModal(false)}> | ||
<Modal.Header className="bg-gray-800"> | ||
<h1 className="text-white font-bold">Edit Topic</h1> | ||
</Modal.Header> | ||
<Modal.Body className="ring-1 bg-background rounded-b-md px-2 py-2"> | ||
<div className="w-full"> | ||
<label htmlFor=""> | ||
<h1 className="text-white py-2">Name of the Topic</h1> | ||
<input | ||
type="text" | ||
className="w-full rounded-md bg-gray-700 text-text" | ||
value={formData?.body_name} | ||
onChange={handleChange} | ||
name="right_name" | ||
/> | ||
</label> | ||
</div> | ||
<div className="w-full mt-3"> | ||
<label htmlFor=""> | ||
<h1 className="text-text py-2">Topic Description</h1> | ||
<textarea | ||
name="right_desc" | ||
value={formData?.body_desc} | ||
onChange={handleChange} | ||
rows={8} | ||
className="w-full rounded-md bg-gray-700 text-white" | ||
></textarea> | ||
</label> | ||
</div> | ||
<button className="text-primary border-2 px-2 py-2 rounded-md float-end"> | ||
Update | ||
</button> | ||
</Modal.Body> | ||
</Modal> | ||
</> | ||
); | ||
} | ||
export default EditBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.