Refactor compliance page files page
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
|
||||
export const createTrustCenterFileMutation = graphql`
|
||||
mutation TrustCenterFileGraphCreateMutation(
|
||||
$input: CreateTrustCenterFileInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
createTrustCenterFile(input: $input) {
|
||||
trustCenterFileEdge @prependEdge(connections: $connections) {
|
||||
node {
|
||||
id
|
||||
name
|
||||
category
|
||||
fileUrl
|
||||
trustCenterVisibility
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useCreateTrustCenterFileMutation() {
|
||||
return useMutationWithToasts(
|
||||
createTrustCenterFileMutation,
|
||||
{
|
||||
successMessage: "File uploaded successfully",
|
||||
errorMessage: "Failed to upload file",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const updateTrustCenterFileMutation = graphql`
|
||||
mutation TrustCenterFileGraphUpdateMutation($input: UpdateTrustCenterFileInput!) {
|
||||
updateTrustCenterFile(input: $input) {
|
||||
trustCenterFile {
|
||||
id
|
||||
name
|
||||
category
|
||||
trustCenterVisibility
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useUpdateTrustCenterFileMutation() {
|
||||
return useMutationWithToasts(
|
||||
updateTrustCenterFileMutation,
|
||||
{
|
||||
successMessage: "File updated successfully",
|
||||
errorMessage: "Failed to update file",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const deleteTrustCenterFileMutation = graphql`
|
||||
mutation TrustCenterFileGraphDeleteMutation(
|
||||
$input: DeleteTrustCenterFileInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
deleteTrustCenterFile(input: $input) {
|
||||
deletedTrustCenterFileId @deleteEdge(connections: $connections)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useDeleteTrustCenterFileMutation() {
|
||||
return useMutationWithToasts(
|
||||
deleteTrustCenterFileMutation,
|
||||
{
|
||||
successMessage: "File deleted successfully",
|
||||
errorMessage: "Failed to delete file",
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -40,16 +40,6 @@ export const trustCenterQuery = graphql`
|
||||
}
|
||||
}
|
||||
}
|
||||
trustCenterFiles(first: 100)
|
||||
@connection(key: "TrustCenterPage_trustCenterFiles") {
|
||||
__id
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
...TrustCenterFilesCardFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user