Last active
June 28, 2020 06:05
-
-
Save shanwixcode/95385c55ead92e05e69719bee79c80f0 to your computer and use it in GitHub Desktop.
Wix Code - Web App For Google Calendar API
This file contains 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
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