fix:little update
This commit is contained in:
parent
c0b54c6eb2
commit
69877617f5
|
|
@ -61,11 +61,13 @@ export default function Login() {
|
|||
if (!username || !password) {
|
||||
error("Username & Password Wajib Diisi !");
|
||||
} else {
|
||||
loading();
|
||||
const response = await emailValidation(data);
|
||||
if (response?.error) {
|
||||
error("Username / Password Tidak Sesuai");
|
||||
return false;
|
||||
}
|
||||
close();
|
||||
|
||||
if (response?.data?.messages[0] === "Continue to setup email") {
|
||||
setFirstLogin(true);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import {
|
|||
useRouter,
|
||||
useSearchParams,
|
||||
} from "next/navigation";
|
||||
import { close, loading } from "@/config/swal";
|
||||
|
||||
export default function ListNews() {
|
||||
const [article, setArticle] = useState<any>([]);
|
||||
|
|
@ -45,7 +46,7 @@ export default function ListNews() {
|
|||
}, [page, category]);
|
||||
|
||||
async function getArticle() {
|
||||
// loading();
|
||||
loading();
|
||||
topRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
|
||||
const req = {
|
||||
|
|
@ -63,7 +64,7 @@ export default function ListNews() {
|
|||
const response = await getListArticle(req);
|
||||
setArticle(response?.data?.data);
|
||||
setTotalPage(response?.data?.meta?.totalPage);
|
||||
// close();
|
||||
close();
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default function NewsDetailPage(props: { datas: any }) {
|
|||
}, []);
|
||||
|
||||
async function getArticles() {
|
||||
const req = { page: 1, search: "", limit: "50" };
|
||||
const req = { page: 1, search: "", limit: "50", isPublish: true };
|
||||
const response = await getListArticle(req);
|
||||
setArticles(response?.data?.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,22 +93,26 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
const index = listArticle.findIndex((item: any) => item?.id === data?.id);
|
||||
if (index - 1 == -1) {
|
||||
setPrevArticle("");
|
||||
} else {
|
||||
const prevString = `${listArticle[index - 1]?.id}-${
|
||||
listArticle[index - 1]?.slug
|
||||
}`;
|
||||
setPrevArticle(prevString);
|
||||
}
|
||||
if (index + 1 == listArticle?.length) {
|
||||
setNextArticle("");
|
||||
} else {
|
||||
const nextString = `${listArticle[index + 1]?.id}-${
|
||||
listArticle[index + 1]?.slug
|
||||
}`;
|
||||
setNextArticle(nextString);
|
||||
if (listArticle) {
|
||||
const index = listArticle?.findIndex(
|
||||
(item: any) => item?.id === data?.id
|
||||
);
|
||||
if (index - 1 == -1) {
|
||||
setPrevArticle("");
|
||||
} else {
|
||||
const prevString = `${listArticle[index - 1]?.id}-${
|
||||
listArticle[index - 1]?.slug
|
||||
}`;
|
||||
setPrevArticle(prevString);
|
||||
}
|
||||
if (index + 1 == listArticle?.length) {
|
||||
setNextArticle("");
|
||||
} else {
|
||||
const nextString = `${listArticle[index + 1]?.id}-${
|
||||
listArticle[index + 1]?.slug
|
||||
}`;
|
||||
setNextArticle(nextString);
|
||||
}
|
||||
}
|
||||
}, [data, listArticle]);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export default function RelatedNews() {
|
|||
|
||||
useEffect(() => {
|
||||
async function getArticle() {
|
||||
const req = { page: 1, search: "", limit: "10" };
|
||||
const req = { page: 1, search: "", limit: "10", isPublish: true };
|
||||
|
||||
const response = await getListArticle(req);
|
||||
setArticle(response?.data?.data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue