apps: use AppController type

This commit is contained in:
Alex Gleason 2023-08-29 13:04:38 -05:00
parent 4d211d637e
commit d21ec6d241
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import type { Context } from '@/deps.ts';
import type { AppController } from '@/app.ts';
/**
* Apps are unnecessary cruft in Mastodon API, but necessary to make clients work.
@ -14,7 +14,7 @@ const FAKE_APP = {
vapid_key: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
};
async function createAppController(c: Context) {
const createAppController: AppController = async (c) => {
// TODO: Handle both formData and json. 422 on parsing error.
try {
const { redirect_uris } = await c.req.json();
@ -26,10 +26,10 @@ async function createAppController(c: Context) {
} catch (_e) {
return c.json(FAKE_APP);
}
}
};
function appCredentialsController(c: Context) {
const appCredentialsController: AppController = (c) => {
return c.json(FAKE_APP);
}
};
export { appCredentialsController, createAppController };