-
Notifications
You must be signed in to change notification settings - Fork 9
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 #619 from IntersectMBO/feat/617-integrate-frontend…
…-with-metadata-validation-service [#617] feat: integrate frontend with metadata validation service
- Loading branch information
Showing
22 changed files
with
146 additions
and
156 deletions.
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
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
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
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 @@ | ||
export * from "./metadataValidation"; |
1 change: 1 addition & 0 deletions
1
govtool/frontend/src/hooks/mutations/metadataValidation/index.ts
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 @@ | ||
export * from "./useValidateMutation"; |
18 changes: 18 additions & 0 deletions
18
govtool/frontend/src/hooks/mutations/metadataValidation/useValidateMutation.ts
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,18 @@ | ||
import { useMutation } from "react-query"; | ||
|
||
import { postValidate } from "@services"; | ||
import { MUTATION_KEYS } from "@consts"; | ||
import { MetadataValidationDTO } from "@models"; | ||
|
||
export const useValidateMutation = () => { | ||
const { data, isLoading, mutateAsync } = useMutation({ | ||
mutationFn: (body: MetadataValidationDTO) => postValidate(body), | ||
mutationKey: [MUTATION_KEYS.postValidateKey], | ||
}); | ||
|
||
return { | ||
validateMetadata: mutateAsync, | ||
validationStatus: data, | ||
isValidating: isLoading, | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./api"; | ||
export * from "./snackbar"; | ||
export * from "./wallet"; | ||
export * from "./metadataValidation"; |
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 @@ | ||
// TODO: Should be taken from @govtool/metadata-validation | ||
export enum MetadataValidationStatus { | ||
URL_NOT_FOUND = "URL_NOT_FOUND", | ||
INVALID_JSONLD = "INVALID_JSONLD", | ||
INVALID_HASH = "INVALID_HASH", | ||
} | ||
|
||
export type ValidateMetadataResult = { | ||
status?: MetadataValidationStatus; | ||
valid: boolean; | ||
}; | ||
|
||
export type MetadataValidationDTO = { | ||
url: string; | ||
hash: string; | ||
}; |
Oops, something went wrong.