cources
This commit is contained in:
parent
1445da33bc
commit
199d472bac
File diff suppressed because one or more lines are too long
@ -1,23 +1,43 @@
|
||||
import React from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import Head from 'next/head';
|
||||
import axios from 'axios';
|
||||
import LayoutGuest from '../../layouts/Guest';
|
||||
import WebSiteHeader from '../../components/WebPageComponents/Header';
|
||||
import WebSiteFooter from '../../components/WebPageComponents/Footer';
|
||||
|
||||
const Cources = () => (
|
||||
const Cources = () => {
|
||||
const [courses, setCourses] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
axios.get('/courses')
|
||||
.then(response => {
|
||||
const dataList = Array.isArray(response.data.rows) ? response.data.rows : [];
|
||||
setCourses(dataList);
|
||||
})
|
||||
.catch(error => console.error(error));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Cources</title>
|
||||
</Head>
|
||||
<WebSiteHeader />
|
||||
<main>
|
||||
{/* Blank public page content */}
|
||||
<main className="container mx-auto py-8">
|
||||
<div className="grid sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{courses.map(course => (
|
||||
<div key={course.id} className="bg-white rounded shadow p-4">
|
||||
<h2 className="text-lg font-semibold mb-2">{course.title}</h2>
|
||||
<p className="text-gray-600">{course.description}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
<WebSiteFooter />
|
||||
</>
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
// Use the guest layout for public pages
|
||||
Cources.getLayout = page => <LayoutGuest>{page}</LayoutGuest>;
|
||||
|
||||
export default Cources;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user