Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,8 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
*/node_modules/
|
*/node_modules/
|
||||||
*/build/
|
*/build/
|
||||||
|
|
||||||
**/node_modules/
|
|
||||||
**/build/
|
|
||||||
.DS_Store
|
|
||||||
.env
|
|
||||||
File diff suppressed because one or more lines are too long
@ -116,6 +116,7 @@ app.use(
|
|||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/courses',
|
'/api/courses',
|
||||||
|
passport.authenticate('jwt', { session: false }),
|
||||||
coursesRoutes,
|
coursesRoutes,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@ -67,11 +67,6 @@ export const webPagesNavBar = [
|
|||||||
href: '/about',
|
href: '/about',
|
||||||
label: 'about',
|
label: 'about',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
href: '/web_pages/cources',
|
|
||||||
label: 'Cources',
|
|
||||||
},
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export default menuNavBar;
|
export default menuNavBar;
|
||||||
|
|||||||
@ -1,60 +0,0 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import type { ReactElement } from 'react';
|
|
||||||
import Head from 'next/head';
|
|
||||||
import LayoutGuest from '../../layouts/Guest';
|
|
||||||
import WebSiteHeader from '../../components/WebPageComponents/Header';
|
|
||||||
import WebSiteFooter from '../../components/WebPageComponents/Footer';
|
|
||||||
import CardBox from '../../components/CardBox';
|
|
||||||
|
|
||||||
interface Course {
|
|
||||||
id: number;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function CourcesPage() {
|
|
||||||
const [courses, setCourses] = useState<Course[]>([]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
fetch('/api/courses')
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(data => {
|
|
||||||
const list = Array.isArray(data)
|
|
||||||
? data
|
|
||||||
: Array.isArray(data.rows)
|
|
||||||
? data.rows
|
|
||||||
: [];
|
|
||||||
setCourses(list);
|
|
||||||
})
|
|
||||||
.catch(err => console.error(err));
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>Cources</title>
|
|
||||||
</Head>
|
|
||||||
<WebSiteHeader projectName="test i18" />
|
|
||||||
<main className="flex-grow bg-white p-8">
|
|
||||||
<h1 className="text-2xl font-bold mb-6">Cources</h1>
|
|
||||||
{courses.length > 0 ? (
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
|
||||||
{courses.map(course => (
|
|
||||||
<CardBox key={course.id} className="p-4">
|
|
||||||
<h2 className="text-xl font-semibold">{course.title}</h2>
|
|
||||||
<p className="mt-2 text-gray-600">{course.description}</p>
|
|
||||||
</CardBox>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<p>No courses found.</p>
|
|
||||||
)}
|
|
||||||
</main>
|
|
||||||
<WebSiteFooter projectName="test i18" />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
CourcesPage.getLayout = function getLayout(page: ReactElement) {
|
|
||||||
return <LayoutGuest>{page}</LayoutGuest>;
|
|
||||||
};
|
|
||||||
Loading…
x
Reference in New Issue
Block a user