UNPKG

@blinkk/editor

Version:

Structured content editor with live previews.

20 lines 876 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const dataStorage_1 = require("../../utility/dataStorage"); const sessionStorage = new dataStorage_1.SessionDataStorage(); const redirectUrl = sessionStorage.getItem('redirectUrl') || '/'; const githubState = sessionStorage.getItem('github.state'); if (!githubState) { // No github state, did not come from the current session. // redirect back to the editor. console.error('No state defined.'); window.location.href = redirectUrl; } const callbackUrl = new URL(window.location.href); const callbackState = callbackUrl.searchParams.get('state'); if (githubState === callbackState) { const callbackCode = callbackUrl.searchParams.get('code'); sessionStorage.setItem('github.code', callbackCode); } window.location.href = redirectUrl; //# sourceMappingURL=githubCallback.js.map