MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / onRevokeKey

Function onRevokeKey

frontend/src/components/forms/User.jsx:149–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147 };
148
149 const onRevokeKey = async () => {
150 if (!canGenerateKey) return;
151
152 setGenerating(true);
153 try {
154 const payload = {};
155 if (authUser.user_level == USER_LEVELS.ADMIN && user?.id) {
156 payload.user_id = user.id;
157 }
158
159 const resp = await revokeApiKey(payload);
160 // backend returns { success: true } - clear local state
161 if (resp && resp.success) {
162 setGeneratedKey(null);
163 setUserAPIKey(null);
164
165 if (user?.id && authUser?.id === user.id) {
166 setUser({ ...authUser, api_key: null });
167 }
168 }
169 } catch {
170 // API shows notifications
171 } finally {
172 setGenerating(false);
173 }
174 };
175
176 return (
177 <Modal opened={isOpen} onClose={onClose} title="User" size="xl">

Callers

nothing calls this directly

Calls 1

revokeApiKeyFunction · 0.90

Tested by

no test coverage detected