diff --git a/app/forum/getItems.js b/app/forum/getItems.js new file mode 100644 index 0000000..8488a0c --- /dev/null +++ b/app/forum/getItems.js @@ -0,0 +1,14 @@ +import PocketBase from "pocketbase"; + +async function getItems() { + const client = new PocketBase('https://backend.saachen.lu'); + const adminAuthData = await client.admins.authViaEmail(process.env.USERNAME, process.env.PASSWORD); +//console.log(adminAuthData); + const resultList = await client.records.getList('forums', 1, 50, { + filter: 'created >= "2022-01-01 00:00:00"', + }); + console.log(resultList); + return resultList; +} + +export default getItems(); \ No newline at end of file diff --git a/app/forum/page.js b/app/forum/page.js index e652f8d..42dc2a1 100644 --- a/app/forum/page.js +++ b/app/forum/page.js @@ -1,6 +1,26 @@ +import getItems from "./forum/getItems"; + export default async function Page({ children }) { - return( -

-

+ const resultList = await getItems; + return ( +
+

hi

+
+ {resultList.items.map((item, i) => ( +
+ // Show all things which you want +
+ {i} +
+ {item.title} +
+ {i} +
+ {item.description} +
+ )) + } +
+
); -} \ No newline at end of file +} diff --git a/app/page.js b/app/page.js index 1fd256d..e652f8d 100644 --- a/app/page.js +++ b/app/page.js @@ -1,37 +1,6 @@ -import PocketBase from "pocketbase"; - -async function getItems() { - const client = new PocketBase('https://backend.saachen.lu'); - const adminAuthData = await client.admins.authViaEmail(process.env.USERNAME, process.env.PASSWORD); -//console.log(adminAuthData); - const resultList = await client.records.getList('forums', 1, 50, { - filter: 'created >= "2022-01-01 00:00:00"', - }); - console.log(resultList); - return resultList; -} - export default async function Page({ children }) { - const resultList = await getItems(); - return ( -
-

hi

-
- {resultList.items.map((item, i) => ( -
- // Show all things which you want -
- {i} -
- {item.title} -
- {i} -
- {item.description} -
- )) - } -
-
- ); -} + return( +

+

+ ); +} \ No newline at end of file