mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-02 17:14:55 +02:00
add supporer key program
This commit is contained in:
parent
1c2ba4076a
commit
cdc415079c
17 changed files with 908 additions and 74 deletions
35
server/routers/supporterKey/hideSupporterKey.ts
Normal file
35
server/routers/supporterKey/hideSupporterKey.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { Request, Response, NextFunction } from "express";
|
||||
import HttpCode from "@server/types/HttpCode";
|
||||
import createHttpError from "http-errors";
|
||||
import logger from "@server/logger";
|
||||
import { response as sendResponse } from "@server/lib";
|
||||
import config from "@server/lib/config";
|
||||
|
||||
export type HideSupporterKeyResponse = {
|
||||
hidden: boolean;
|
||||
};
|
||||
|
||||
export async function hideSupporterKey(
|
||||
req: Request,
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
): Promise<any> {
|
||||
try {
|
||||
config.hideSupporterKey();
|
||||
|
||||
return sendResponse<HideSupporterKeyResponse>(res, {
|
||||
data: {
|
||||
hidden: true
|
||||
},
|
||||
success: true,
|
||||
error: false,
|
||||
message: "Hidden",
|
||||
status: HttpCode.OK
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
return next(
|
||||
createHttpError(HttpCode.INTERNAL_SERVER_ERROR, "An error occurred")
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue