Skip to content

Commit

Permalink
Merge pull request #47 from soup-bowl/replace-wpapi
Browse files Browse the repository at this point in the history
Replace WPAPI with bespoke Agent
  • Loading branch information
soup-bowl authored Aug 3, 2023
2 parents fb86e4c + 96b6463 commit f3c2d69
Show file tree
Hide file tree
Showing 15 changed files with 280 additions and 218 deletions.
153 changes: 1 addition & 152 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"@types/node": "^20.4.0",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.0.11",
"@types/wpapi": "^1.1.1",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"@vitejs/plugin-react-swc": "^3.3.2",
Expand All @@ -26,8 +25,7 @@
"react-router-dom": "^6.11.2",
"typescript": "^5.0.3",
"vite": "^4.4.8",
"vite-plugin-pwa": "^0.16.4",
"wpapi": "^1.2.2"
"vite-plugin-pwa": "^0.16.4"
},
"scripts": {
"start": "npm run dev",
Expand Down
9 changes: 9 additions & 0 deletions src/api/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export enum EPostType {
Post,
Page
}

export enum ETagType {
Category,
Tag
}
3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as WordPressApi } from './wordpress';
export * from './interfaces';
export * from './enums';
37 changes: 36 additions & 1 deletion src/interfaces.ts → src/api/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
// Interaction Interfaces

import { EPostType } from ".";

export interface IInnnerConstruct {
endpoint: string;
}

export interface IndexableInput {
page?: number;
perPage?: number;
byCategory?: number;
byTag?: number;
}

export interface FetchInput extends IndexableInput {
type: EPostType;
parent?: number;
}

export interface SearchInput extends IndexableInput {
search: string;
}

// Data Interfaces

export interface IWPAPIError {
code: string;
message: string;
Expand Down Expand Up @@ -109,9 +135,18 @@ export interface IStorage {
export interface IWPIndexing {
total: number;
totalPages: number;
links: IWPIndexingLinks;
}

export interface IWPIndexingLinks {
next: string;
}

export interface IPostCollection {
posts: IPost[];
pagination: IWPIndexing;
}

export interface ISearchCollection {
results: ISearch[];
pagination: IWPIndexing;
}
Loading

0 comments on commit f3c2d69

Please sign in to comment.