Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wix Code - Web App For Google Calendar API
import {client, getAuthUrl, generateTokens} from 'backend/config.jsw';
export function clientConfig_keyPress(event) {
if (event.key === "Enter") {
let str = $w('#clientConfig').value;
if (str.length === 0)
return;
client(str).then(item => {
$w('#configUploaded').show();
enableCodeButton();
})
.catch(error => {
console.log(error);
});
}
}
export function enableCodeButton() {
if ($w('#configUploaded').hidden === false) {
getAuthUrl().then((url) => {
$w("#getCode").link = url;
$w("#getCode").enable();
}).catch(console.log);
}
}
export function authKey_keyPress(event) {
if (event.key === "Enter") {
let str = $w('#authKey').value;
if (str.length === 0)
return;
generateTokens(str).then(() => {
$w('#authSuccess').show();
})
.catch(error => {
console.log(error);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment