auth: getting viewer_id and access_token

This commit is contained in:
muerwre 2018-12-10 12:38:59 +07:00
parent e8a2e04562
commit 678f2b17a4
3 changed files with 17 additions and 3 deletions

View file

@ -12,7 +12,7 @@ import {
setSaveOverwrite, setSaveSuccess, setTitle,
setUser
} from '$redux/user/actions';
import { getUrlData, pushPath } from '$utils/history';
import { getUrlData, parseQuery, pushPath } from '$utils/history';
import { editor } from '$modules/Editor';
import { ACTIONS } from '$redux/user/constants';
import { MODES } from '$constants/modes';
@ -104,7 +104,9 @@ function* loadMapSaga(path) {
function* mapInitSaga() {
const { hash } = getUrlData();
console.log('got credentials', window.location);
const { viewer_id, access_token } = yield parseQuery(window.location.search);
if (viewer_id && access_token) console.log('GOT THEM!', { viewer_id, access_token });
if (hash && /^#map/.test(hash)) {
const [, newUrl] = hash.match(/^#map[:/?!](.*)$/);