added the pageload api

This commit was merged in pull request #546.
This commit is contained in:
2024-01-10 17:41:52 +01:00
parent 9dde87277c
commit 57be599bb5
5 changed files with 91 additions and 1 deletions
+10 -1
View File
@@ -2,8 +2,12 @@ import React, { useState } from "react";
import Layout from "../Partials/Layout";
import usersService from "../../services/UsersService";
import YourPageForm from "./YourPageForm";
import LoadedPage from "./LoadedPage";
import { useDispatch } from "react-redux";
import { tableReload } from "../../store/TableReloads";
const YourPage = () => {
const dispatch = useDispatch;
const [pageValues, setPageValues] = useState({
intro: "",
description: "",
@@ -22,6 +26,8 @@ const YourPage = () => {
};
const updateYourPageDetails = async () => {
if (!pageValues.intro || !pageValues.description) return;
try {
setResponse({ loading: true, error: "", msg: "" });
@@ -35,6 +41,8 @@ const YourPage = () => {
msg: "Page updated successfully",
});
dispatch(tableReload({ type: "YourPageTable" }));
// Clear form after successful update
setPageValues({ intro: "", description: "" });
}, 2000);
@@ -52,7 +60,7 @@ const YourPage = () => {
<Layout>
<div className="notification-page w-full mb-10">
<div className="notification-wrapper w-full">
<div className="update-table w-full h-full p-4 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow min-h-[520px]">
<div className="update-table w-full h-full p-4 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow min-h-[650px]">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide mb-2">
My page
</h1>
@@ -63,6 +71,7 @@ const YourPage = () => {
onSubmit={updateYourPageDetails}
loading={response.loading}
/>
<LoadedPage />
</div>
</div>
</div>