-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from OpenCatalogi/publications
added publication page
- Loading branch information
Showing
13 changed files
with
1,500 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Send } from "../apiService"; | ||
import { AxiosInstance } from "axios"; | ||
|
||
export default class Publication { | ||
private _instance: AxiosInstance; | ||
|
||
constructor(_instance: AxiosInstance) { | ||
this._instance = _instance; | ||
} | ||
|
||
public getContent = async (fileName: string): Promise<any> => { | ||
const { data } = await Send(this._instance, "GET", fileName); | ||
|
||
return data; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from "react"; | ||
import { useQuery } from "react-query"; | ||
import APIService from "../apiService/apiService"; | ||
import APIContext from "../apiService/apiContext"; | ||
import { getFileNameFromUrl } from "../services/FileNameFromUrl"; | ||
import { DEFAULT_HEADER_CONTENT_URL } from "../templates/templateParts/header/HeaderTemplate"; | ||
|
||
export const usePublication = () => { | ||
const API: APIService | null = React.useContext(APIContext); | ||
|
||
const fileName = getFileNameFromUrl( | ||
"https://raw.githubusercontent.com/ConductionNL/OpenCatalogApp/feature/AQ212-8/publicatie-modal/docs/dcat_example.json", | ||
); | ||
|
||
const getContent = () => | ||
useQuery<any, Error>(["contents", fileName], () => API?.Publication.getContent(fileName), { | ||
onError: (error) => { | ||
console.warn(error.message); | ||
}, | ||
}); | ||
|
||
return { getContent }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as React from "react"; | ||
import { PageProps } from "gatsby"; | ||
import { ComponentsTemplate } from "../../templates/components/ComponentsTemplate"; | ||
|
||
const PublicationsPage: React.FC<PageProps> = () => { | ||
return <ComponentsTemplate />; | ||
}; | ||
|
||
export default PublicationsPage; |
8 changes: 8 additions & 0 deletions
8
pwa/src/pages/publications/[publicationId]/PublicationsDetailPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import * as React from "react"; | ||
import { PageProps } from "gatsby"; | ||
import { PublicationsDetailTemplate } from "../../../templates/publicationDetail/PublicationsDetailTemplate"; | ||
|
||
const PublicationsDetailPage: React.FC<PageProps> = (props: PageProps) => { | ||
return <PublicationsDetailTemplate publicationId={props.params.componentId} />; | ||
}; | ||
export default PublicationsDetailPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import PublicationsDetailPage from "./PublicationsDetailPage"; | ||
|
||
export default PublicationsDetailPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import PublicationsPage from "./PublicationsPage"; | ||
|
||
export default PublicationsPage; |
Oops, something went wrong.