Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
24 lines
652 B
Plaintext
24 lines
652 B
Plaintext
import { sendEvent } from '../index.js';
|
|
import { oneWayHash } from '../oneWayHash.js';
|
|
export const adminInit = ({ headers, payload, user })=>{
|
|
const host = headers.get('host');
|
|
let domainID;
|
|
let userID;
|
|
if (host) {
|
|
domainID = oneWayHash(host, payload.secret);
|
|
}
|
|
if (user?.id) {
|
|
userID = oneWayHash(String(user.id), payload.secret);
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
sendEvent({
|
|
event: {
|
|
type: 'admin-init',
|
|
domainID: domainID,
|
|
userID: userID
|
|
},
|
|
payload
|
|
});
|
|
};
|
|
|
|
//# sourceMappingURL=adminInit.js.map |