From 5f8362bc9272af730a084b7cc1dda6537f7f8d40 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 29 Mar 2023 11:12:15 +0700 Subject: blog --- .../components/elements/Navbar/NavbarDesktop.jsx | 2 +- src/pages/blog/[slug].jsx | 0 src/pages/blog/index.jsx | 75 ++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/pages/blog/[slug].jsx create mode 100644 src/pages/blog/index.jsx (limited to 'src') diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index 7e66a234..e06b327a 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -104,7 +104,7 @@ const NavbarDesktop = () => { Ready Stock Blog Indoteknik diff --git a/src/pages/blog/[slug].jsx b/src/pages/blog/[slug].jsx new file mode 100644 index 00000000..e69de29b diff --git a/src/pages/blog/index.jsx b/src/pages/blog/index.jsx new file mode 100644 index 00000000..c755ec82 --- /dev/null +++ b/src/pages/blog/index.jsx @@ -0,0 +1,75 @@ +import BasicLayout from '@/core/components/layouts/BasicLayout' +import { Card, Spinner } from 'flowbite-react' +import Link from 'next/link' +import { useCallback, useEffect, useState } from 'react' +import { createSlug } from '@/core/utils/slug' +import useDevice from '@/core/hooks/useDevice' +import Image from 'next/image' +import odooApi from '@/core/api/odooApi' + +export default function Blogs() { + const [isLoading, setIsLoading] = useState(true) + const [blogsValues, setBlogs] = useState([]) + const { isMobile } = useDevice() + + const getBlogs = useCallback(async () => { + // setIsLoading(true) + const result = await odooApi('GET', '/api/v1/blog') + setBlogs(result.blogs) + setIsLoading(false) + }, []) + + useEffect(() => { + getBlogs() + }, [getBlogs]) + + if (isLoading) { + return ( + <> + +
+ +
+
+ + ) + } + return ( + +
+
+

Blog Indoteknik

+
+
+ {blogsValues?.map((blog, index) => { + return ( +
+ {blog.title} +
+ + {blog.category.name} + + + {blog.title} + +

+ {blog.postDate} +

+
+
+ ) + })} +
+
+
+ ) +} -- cgit v1.2.3