diff options
Diffstat (limited to 'web/source/settings/lib/query')
-rw-r--r-- | web/source/settings/lib/query/admin/index.js | 26 | ||||
-rw-r--r-- | web/source/settings/lib/query/base.js | 2 |
2 files changed, 27 insertions, 1 deletions
diff --git a/web/source/settings/lib/query/admin/index.js b/web/source/settings/lib/query/admin/index.js index 534ae962c..dd4a61b51 100644 --- a/web/source/settings/lib/query/admin/index.js +++ b/web/source/settings/lib/query/admin/index.js @@ -78,6 +78,32 @@ const endpoints = (build) => ({ } }) }), + getAccount: build.query({ + query: (id) => ({ + url: `/api/v1/accounts/${id}` + }), + providesTags: (_, __, id) => [{ type: "Account", id }] + }), + actionAccount: build.mutation({ + query: ({ id, action, reason }) => ({ + method: "POST", + url: `/api/v1/admin/accounts/${id}/action`, + asForm: true, + body: { + type: action, + text: reason + } + }), + invalidatesTags: (_, __, { id }) => [{ type: "Account", id }] + }), + searchAccount: build.mutation({ + query: (username) => ({ + url: `/api/v2/search?q=${encodeURIComponent(username)}&resolve=true` + }), + transformResponse: (res) => { + return res.accounts ?? []; + } + }), ...require("./import-export")(build), ...require("./custom-emoji")(build), ...require("./reports")(build) diff --git a/web/source/settings/lib/query/base.js b/web/source/settings/lib/query/base.js index bee19bf18..f880853d2 100644 --- a/web/source/settings/lib/query/base.js +++ b/web/source/settings/lib/query/base.js @@ -73,7 +73,7 @@ function instanceBasedQuery(args, api, extraOptions) { module.exports = createApi({ reducerPath: "api", baseQuery: instanceBasedQuery, - tagTypes: ["Auth", "Emoji", "Reports"], + tagTypes: ["Auth", "Emoji", "Reports", "Account"], endpoints: (build) => ({ instance: build.query({ query: () => ({ |