-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feat/ui-improvements
- Loading branch information
Showing
10 changed files
with
557 additions
and
38 deletions.
There are no files selected for viewing
Submodule forge-std
updated
43 files
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,40 @@ | ||
import { gql, type GraphQLClient } from "graphql-request"; | ||
import { Products } from "."; | ||
|
||
export type Role = { | ||
name: string; | ||
restriction: { | ||
maxSize: number; | ||
allowedMimeTypes: string[]; | ||
}; | ||
}; | ||
|
||
type FetchRolesResponse = { | ||
roles: Role[]; | ||
}; | ||
|
||
const query = gql` | ||
query Roles($product: Products!) { | ||
roles(product: $product) { | ||
name | ||
restriction { | ||
maxSize | ||
allowedMimeTypes | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export async function fetchRestrictions(client: GraphQLClient, product: Products): Promise<Role[]> { | ||
return client | ||
.request<FetchRolesResponse>(query, { product }) | ||
.then((response) => response.roles) | ||
.catch((errors) => { | ||
// eslint-disable-next-line no-console | ||
console.log("Error fetching roles :", { errors }); | ||
const errorMessage = Array.isArray(errors?.response?.errors) | ||
? errors.response.errors[0]?.message | ||
: "Error fetching roles"; | ||
throw Error(errorMessage); | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -25,7 +25,8 @@ | |
"web-devtools", | ||
"eslint-config", | ||
"prettier-config", | ||
"tsconfig" | ||
"tsconfig", | ||
"kleros-app" | ||
], | ||
"packageManager": "[email protected]", | ||
"volta": { | ||
|
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
Oops, something went wrong.