1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

refactor: clean up no longer used PAT methods (#4621)

This cleans up some PAT-related methods that are no longer used.
This commit is contained in:
Nuno Góis 2023-09-07 08:48:55 +01:00 committed by GitHub
parent 90395b974b
commit cfbf47d6bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,38 +37,9 @@ export const usePersonalAPITokensApi = () => {
}
};
const createUserPersonalAPIToken = async (
userId: number,
payload: ICreatePersonalApiTokenPayload
): Promise<INewPersonalAPIToken> => {
const req = createRequest(`api/admin/user-admin/${userId}/pat`, {
method: 'POST',
body: JSON.stringify(payload),
});
try {
const response = await makeRequest(req.caller, req.id);
return await response.json();
} catch (e) {
throw e;
}
};
const deleteUserPersonalAPIToken = async (userId: number, id: string) => {
const req = createRequest(`api/admin/user-admin/${userId}/pat/${id}`, {
method: 'DELETE',
});
try {
await makeRequest(req.caller, req.id);
} catch (e) {
throw e;
}
};
return {
createPersonalAPIToken,
deletePersonalAPIToken,
createUserPersonalAPIToken,
deleteUserPersonalAPIToken,
errors,
loading,
};