Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Store fcm token in report data
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent ea98d7d commit 4978659
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions functions/api/reports/submit.ts
Expand Up @@ -2,8 +2,15 @@ import { GenerateUploadURL } from "../../gcloud.js";
import { jsonError, jsonResponse } from "../../common.js";

export async function onRequestPost(context: RequestContext) {
const { actions, bypass, description, files, turnstileResponse, usernames } =
context.data.body;
const {
actions,
bypass,
description,
files,
senderTokenId,
turnstileResponse,
usernames,
} = context.data.body;

if (!context.data.current_user) {
if (typeof turnstileResponse !== "string")
Expand Down Expand Up @@ -200,6 +207,7 @@ export async function onRequestPost(context: RequestContext) {
JSON.stringify({
attachments,
created_at: Date.now(),
fcm_token: typeof senderTokenId === "string" ? senderTokenId : undefined,
id: reportId,
open: !bypass,
user: currentUser
Expand Down

0 comments on commit 4978659

Please sign in to comment.