summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/_getFirstQueryParam.ts13
-rw-r--r--api/auth/registration.ts11
2 files changed, 13 insertions, 11 deletions
diff --git a/api/_getFirstQueryParam.ts b/api/_getFirstQueryParam.ts
new file mode 100644
index 0000000..2073e7a
--- /dev/null
+++ b/api/_getFirstQueryParam.ts
@@ -0,0 +1,13 @@
+import type { VercelRequest } from '@vercel/node';
+
+export function getFirstQueryParam(key: string, query: VercelRequest['query']): string | null {
+ const value = query[key];
+ if (!value) {
+ return null;
+ }
+ if (typeof(value) === 'string') {
+ return value;
+ }
+ return value[0] as string;
+}
+
diff --git a/api/auth/registration.ts b/api/auth/registration.ts
index 9f1c377..912e5bf 100644
--- a/api/auth/registration.ts
+++ b/api/auth/registration.ts
@@ -96,17 +96,6 @@ async function handleGet(request: VercelRequest): Promise<(r: VercelResponse) =>
return (response) => void (response.status(200).json(options));
}
-function getFirstQueryParam(key: string, query: VercelRequest['query']): string | null {
- const value = query[key];
- if (!value) {
- return null;
- }
- if (typeof(value) === 'string') {
- return value;
- }
- return value[0] as string;
-}
-
async function handlePost(request: VercelRequest): Promise<(r: VercelResponse) => void> {
type Body = {
userId: string,