feat(client,api): add user tokens and route for submitting coderoad tutorials (#43304)

Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com>
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Tom
2021-11-17 08:19:24 -06:00
committed by GitHub
parent 4eb036a2bb
commit f0698aa517
25 changed files with 722 additions and 26 deletions

View File

@@ -35,8 +35,12 @@ function put<T = void>(path: string, body: unknown): Promise<T> {
return request('PUT', path, body);
}
function deleteRequest<T = void>(path: string, body: unknown): Promise<T> {
return request('DELETE', path, body);
}
async function request<T>(
method: 'POST' | 'PUT',
method: 'POST' | 'PUT' | 'DELETE',
path: string,
body: unknown
): Promise<T> {
@@ -207,6 +211,10 @@ export function postResetProgress(): Promise<void> {
return post('/account/reset-progress', {});
}
export function postWebhookToken(): Promise<void> {
return post('/user/webhook-token', {});
}
/** PUT **/
interface MyAbout {
@@ -249,3 +257,8 @@ export function putUserUpdateEmail(email: string): Promise<void> {
export function putVerifyCert(certSlug: string): Promise<void> {
return put('/certificate/verify', { certSlug });
}
/** DELETE **/
export function deleteWebhookToken(): Promise<void> {
return deleteRequest('/user/webhook-token', {});
}