Refactor Code to typescript
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
declare function _exports(params?: {
|
||||
database?: string;
|
||||
userId?: string | number;
|
||||
}): {
|
||||
keyCookieName: string;
|
||||
csrfCookieName: string;
|
||||
oneTimeCodeName: string;
|
||||
};
|
||||
export = _exports;
|
||||
+12
-9
@@ -1,15 +1,18 @@
|
||||
// @ts-check
|
||||
type Param = {
|
||||
database?: string;
|
||||
userId?: string | number;
|
||||
};
|
||||
|
||||
type Return = {
|
||||
keyCookieName: string;
|
||||
csrfCookieName: string;
|
||||
oneTimeCodeName: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* # Grab Auth Cookie Names
|
||||
*
|
||||
* @param {object} [params]
|
||||
* @param {string} [params.database]
|
||||
* @param {string | number} [params.userId]
|
||||
*
|
||||
* @returns {{ keyCookieName: string, csrfCookieName: string, oneTimeCodeName: string }}
|
||||
*/
|
||||
module.exports = function getAuthCookieNames(params) {
|
||||
export default function getAuthCookieNames(params?: Param): Return {
|
||||
const cookiesPrefix = process.env.DSQL_COOKIES_PREFIX || "dsql_";
|
||||
const cookiesKeyName = process.env.DSQL_COOKIES_KEY_NAME || "key";
|
||||
const cookiesCSRFName = process.env.DSQL_COOKIES_CSRF_NAME || "csrf";
|
||||
@@ -40,4 +43,4 @@ module.exports = function getAuthCookieNames(params) {
|
||||
csrfCookieName,
|
||||
oneTimeCodeName,
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user