Skip to content

Commit

Permalink
fix: ajuste la jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Feb 26, 2025
1 parent 0ac4f4b commit bf843cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions front/src/helpers/graphQL.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ async function getErrorResponse(response) {
}

/**
* @param {string} query request query (as string)
* @param {{[string: key]: value}|undefined} variables request variables
* @param {string} sessionToken session token (for authentication)
* @param {'fetch'|'mutate'} [type='fetch'] request type (either fetch or mutate)
* @param {object} config request configuration
* @param {string} config.query request query (as string)
* @param {{[string: key]: value}|undefined} config.variables request variables
* @param {string} config.sessionToken session token (for authentication)
* @param {'fetch'|'mutate'} config.type request type (either fetch or mutate)
* @returns {Promise<string|object>}
*/
async function executeRequest({
Expand Down Expand Up @@ -82,18 +83,18 @@ async function executeRequest({
export function useGraphQLClient() {
const sessionToken = useSelector((state) => state.sessionToken)
return {
query: ({query, variables}) =>
query: ({ query, variables }) =>
executeQuery({ query, variables, sessionToken }),
}
}

/**
* @param {Object} context query context
* @param {object} context query context
* @param {DocumentNode|string} context.query request query (as AST or string)
* @param {{[string: key]: any}|undefined} context.variables request variables
* @param {string} context.sessionToken session token (for authentication)
* @param {'fetch'|'mutate'} [context.type='fetch'] request type (either fetch or mutate)
* @returns {Promise<string|object>}
* @param {'fetch'|'mutate'} context.type request type (either fetch or mutate)
* @returns {Promise<string|{[key: string]: any}>}
* @throws Error if something went wrong
*/
export function executeQuery({
Expand Down
4 changes: 2 additions & 2 deletions front/src/hooks/contributor.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function useArticleContributorActions({ articleId }) {
query: addContributorQuery,
variables: { userId: contributorId, articleId },
})
await mutate(key, async (_) => ({
await mutate(key, async () => ({
article: {
contributors: response.article.addContributor.contributors,
},
Expand All @@ -34,7 +34,7 @@ export function useArticleContributorActions({ articleId }) {
query: removeContributorQuery,
variables: { userId: contributorId, articleId },
})
await mutate(key, async (_) => ({
await mutate(key, async () => ({
article: {
contributors: response.article.removeContributor.contributors,
},
Expand Down

0 comments on commit bf843cd

Please sign in to comment.