This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new user | |
/** [@calcom] 1. Create the user in cal */ | |
let calUser: Omit<CalManageUserResponse, "status">["data"] | null = | |
null; | |
const url = `${env.NEXT_PUBLIC_CAL_API_URL}/oauth-clients/${env.NEXT_PUBLIC_CAL_OAUTH_CLIENT_ID}/users`; | |
const response = await fetch(url, { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
"x-cal-secret-key": env.CAL_SECRET, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add any additional (also optional) values if you want to keep track of something (e.g. object location) | |
export function someRecursiveFunction(args: { object: any }): any { | |
// early return | |
if (!args.object) return args.object; | |
// UPDATE THIS: The logic you'd like the function to take | |
if ("id" in args.object && args.object.type === "item") { | |
delete args.object.id; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.runtime.onInstalled.addListener(() => { | |
await syncUser() | |
const {tokens, isSignedIn} = chrome.storage.sync.get('authentication') | |
// initiate signup flow on my web app if user isn't signed in yet | |
if (!isSignedIn && !tokens) { | |
chrome.tabs.create({url : "proprietary.web.app/signup"}) | |
} | |
}) | |
chrome.runtime.onMessage.addListener((message) => { |