Skip to content

Commit

Permalink
Add ContentDataTypes to utils/content.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ProchaLu committed Feb 26, 2024
1 parent 313a460 commit 24b1dec
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion utils/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ export type IContent = {

export type IContentType = 'articles' | 'notes' | 'works';

export type ContentDataTypes = {
id: string;
contentHtml: string;
problem?: string;
techStack?: string[];
} & Pick<
IContent,
| 'title'
| 'draft'
| 'date'
| 'previewImage'
| 'description'
| 'tags'
| 'category'
>;

/**
* Sorts content by their dates
* @param a {Date} - Date of post 1
Expand Down Expand Up @@ -99,7 +115,10 @@ export const getAllContentIds = (contentType: IContentType) => {
* @param {string} contentType Type of content
*/

export const getContentData = async (id: string, contentType: IContentType) => {
export const getContentData = async (
id: string,
contentType: IContentType,
): Promise<ContentDataTypes> => {
let contentTypeDirectory: string;
let filenames;
switch (contentType.toLowerCase()) {
Expand Down

0 comments on commit 24b1dec

Please sign in to comment.