Install (add to fpm.toml)
@@ -278,13 +286,22 @@ const sideBar = (data, setShowReportForm) => {
Last publish
{updatedDays(data.updated_at)} days ago
-
+
+
+
+
);
};
diff --git a/frontend/src/pages/ratePackageForm.js b/frontend/src/pages/ratePackageForm.js
new file mode 100644
index 00000000..eeb81198
--- /dev/null
+++ b/frontend/src/pages/ratePackageForm.js
@@ -0,0 +1,90 @@
+import React, { useEffect, useState } from "react";
+import { Form, Button, Modal, Spinner } from "react-bootstrap";
+import { useDispatch, useSelector } from "react-redux";
+import { toast, ToastContainer } from "react-toastify";
+import {
+ ratePackage,
+ resetErrorMessage,
+} from "../store/actions/ratePackageActions";
+
+const RatePackageForm = (props) => {
+ const dispatch = useDispatch();
+ const [rating, setRating] = useState("");
+ const accessToken = useSelector((state) => state.auth.accessToken);
+ const isLoading = useSelector((state) => state.ratePackage.isLoading);
+ const statusCode = useSelector((state) => state.ratePackage.statuscode);
+ const message = useSelector((state) => state.ratePackage.message);
+
+ const handleSubmit = async (e) => {
+ e.preventDefault();
+ dispatch(
+ ratePackage(
+ { rating: rating, namespace: props.namespace, package: props.package },
+ accessToken
+ )
+ );
+ };
+
+ useEffect(() => {
+ if (statusCode === 200) {
+ toast.success(message);
+ } else {
+ toast.error(message);
+ }
+
+ dispatch(resetErrorMessage());
+ }, [statusCode]);
+
+ return (
+