hippofish/packages/backend/src/server/api/endpoints/sw/unregister.ts
ThatOneCalculator daba80177a
feat: push notifs button
Co-authored-by: Tamania <tamaina@hotmail.co.jp>
2023-04-03 20:36:59 -07:00

25 lines
531 B
TypeScript

import { SwSubscriptions } from "@/models/index.js";
import define from "../../define.js";
export const meta = {
tags: ["account"],
requireCredential: false,
description: "Unregister from receiving push notifications.",
} as const;
export const paramDef = {
type: "object",
properties: {
endpoint: { type: "string" },
},
required: ["endpoint"],
} as const;
export default define(meta, paramDef, async (ps, me) => {
await SwSubscriptions.delete({
...(me ? { userId: me.id } : {}),
endpoint: ps.endpoint,
});
});