13 lines
541 B
TypeScript
13 lines
541 B
TypeScript
import { ApiCall } from "tsrpc";
|
|
import { EmailFun } from '../../public/email';
|
|
import { ReqRemove, ResRemove } from "../../shared/protocols/email/PtlRemove";
|
|
|
|
export default async function (call: ApiCall<ReqRemove, ResRemove>) {
|
|
let email = await EmailFun.getEmail(call.uid, call.req._id);
|
|
|
|
if (!email) return call.error(globalThis.lng.email_3);
|
|
|
|
if (email.prizeData?.isGet == false && email.prizeData?.prize?.length > 0) return call.error(globalThis.lng.email_6);
|
|
|
|
call.succ(EmailFun.removeEmail(call.uid, call.req._id));
|
|
} |