Skip to content

Commit

Permalink
chore: Remove unused code and comments in page.tsx and landing.tsx files
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem1211 committed Jul 31, 2024
1 parent c67a373 commit 47db8b2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
96 changes: 48 additions & 48 deletions packages/landing/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
import React from 'react';
import { Landing } from '@/widgets/landing/landing';
import { VersionAlert } from '@slender/shared/components/version-alert';
import { BLOG_TAG } from '@/global/constants';
import GhostContentAPI from '@tryghost/content-api';
// import { BLOG_TAG } from '@/global/constants';
import { PostOrPage } from '@tryghost/content-api';

async function makeRequest<H extends {}, P extends {}>({
url,
method,
headers: _headers,
params,
}: {
url: string;
method: string;
headers: H;
params: P;
}) {
const headers = new Headers();
const q = new URLSearchParams();
// async function makeRequest<H extends {}, P extends {}>({
// url,
// method,
// headers: _headers,
// params,
// }: {
// url: string;
// method: string;
// headers: H;
// params: P;
// }) {
// const headers = new Headers();
// const q = new URLSearchParams();

// eslint-disable-next-line no-restricted-syntax
for (const [key, value] of Object.entries(_headers)) {
headers.append(key, String(value));
}
// // eslint-disable-next-line no-restricted-syntax
// for (const [key, value] of Object.entries(_headers)) {
// headers.append(key, String(value));
// }

// eslint-disable-next-line no-restricted-syntax
for (const [key, value] of Object.entries(params)) {
q.append(key, String(value));
}
// // eslint-disable-next-line no-restricted-syntax
// for (const [key, value] of Object.entries(params)) {
// q.append(key, String(value));
// }

const response = await fetch(`${url}?${q.toString()}`, {
headers,
method,
next: { tags: [BLOG_TAG] },
});
// const response = await fetch(`${url}?${q.toString()}`, {
// headers,
// method,
// next: { tags: [BLOG_TAG] },
// });

const data = await response.json();
// const data = await response.json();

return {
data,
status: response.status,
statusText: response.statusText,
headers: response.headers,
};
}
// return {
// data,
// status: response.status,
// statusText: response.statusText,
// headers: response.headers,
// };
// }

const api = new GhostContentAPI({
url: 'https://marginly.ghost.io',
key: '058e253a4681b854b7163ee0e6',
version: 'v5.0',
makeRequest,
});
const POSTS_LIMIT = 100;
// const api = new GhostContentAPI({
// url: 'https://marginly.ghost.io',
// key: '058e253a4681b854b7163ee0e6',
// version: 'v5.0',
// makeRequest,
// });
// const POSTS_LIMIT = 100;
const POSTS_WITH_ALLOWED_TAG_AMOUNT = 3;

export default async function Home() {
const apiPosts = await api.posts.browse({
limit: POSTS_LIMIT,
include: 'tags',
});

// const apiPosts = await api.posts.browse({
// limit: POSTS_LIMIT,
// include: 'tags',
// });
const apiPosts = undefined as undefined | PostOrPage[];
const articlesWithAllowedTag = apiPosts?.slice(0, POSTS_WITH_ALLOWED_TAG_AMOUNT);
return (
<main>
Expand Down
2 changes: 1 addition & 1 deletion packages/landing/src/widgets/landing/landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const APP_LINK = 'https://app.slender.fi';
const SUBSCRIPTION_ANCHOR = 'subscription';

interface Props {
posts: PostOrPage[];
posts?: PostOrPage[];
}

function ShowAllButton({ className }: { className?: string }) {
Expand Down

0 comments on commit 47db8b2

Please sign in to comment.