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