mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
auth: added backend debugging x4
This commit is contained in:
parent
1cfcb733e7
commit
b5772bd33d
3 changed files with 16 additions and 9 deletions
|
@ -48,3 +48,5 @@ export const setReady = ready => ({ type: ACTIONS.SET_READY, ready });
|
||||||
|
|
||||||
export const gotVkUser = user => ({ type: ACTIONS.GOT_VK_USER, user });
|
export const gotVkUser = user => ({ type: ACTIONS.GOT_VK_USER, user });
|
||||||
export const keyPressed = ({ key }) => ({ type: ACTIONS.KEY_PRESSED, key });
|
export const keyPressed = ({ key }) => ({ type: ACTIONS.KEY_PRESSED, key });
|
||||||
|
|
||||||
|
export const iframeLoginVk = payload => ({ type: ACTIONS.IFRAME_LOGIN_VK, ...payload });
|
||||||
|
|
|
@ -48,4 +48,6 @@ export const ACTIONS = ({
|
||||||
|
|
||||||
GOT_VK_USER: 'GOT_VK_USER',
|
GOT_VK_USER: 'GOT_VK_USER',
|
||||||
KEY_PRESSED: 'KEY_PRESSED',
|
KEY_PRESSED: 'KEY_PRESSED',
|
||||||
|
|
||||||
|
IFRAME_LOGIN_VK: 'IFRAME_LOGIN_VK',
|
||||||
}: { [key: String]: String });
|
}: { [key: String]: String });
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { delay } from 'redux-saga';
|
||||||
import { takeLatest, select, call, put, takeEvery, race, take } from 'redux-saga/effects';
|
import { takeLatest, select, call, put, takeEvery, race, take } from 'redux-saga/effects';
|
||||||
import { checkUserToken, getGuestToken, getStoredMap, getVkIframeUser, postMap } from '$utils/api';
|
import { checkUserToken, getGuestToken, getStoredMap, getVkIframeUser, postMap } from '$utils/api';
|
||||||
import {
|
import {
|
||||||
hideRenderer,
|
hideRenderer, iframeLoginVk,
|
||||||
setActiveSticker, setAddress,
|
setActiveSticker, setAddress,
|
||||||
setChanged, setDialogActive,
|
setChanged, setDialogActive,
|
||||||
setEditing,
|
setEditing,
|
||||||
|
@ -102,21 +102,24 @@ function* loadMapSaga(path) {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
function* vkIframeAuth({ viewer_id, access_token }) {
|
function* vkIframeAuth({ viewer_id, access_token, auth_key }) {
|
||||||
const user = yield call(getVkIframeUser, { viewer_id, access_token });
|
// const user = yield call(getVkIframeUser, { viewer_id, access_token });
|
||||||
|
//
|
||||||
if (user) return yield put(setUser(user));
|
// if (user) return yield put(setUser(user));
|
||||||
|
//
|
||||||
return null;
|
// return null;
|
||||||
|
return yield console.log('GOT', { viewer_id, access_token, auth_key });
|
||||||
}
|
}
|
||||||
|
|
||||||
function* mapInitSaga() {
|
function* mapInitSaga() {
|
||||||
const { hash } = getUrlData();
|
const { hash } = getUrlData();
|
||||||
const { viewer_id, access_token } = yield parseQuery(window.location.search);
|
const { viewer_id, access_token, auth_key } = yield parseQuery(window.location.search);
|
||||||
|
|
||||||
// const viewer_id = '360004';
|
// const viewer_id = '360004';
|
||||||
// const access_token = '35baba3da5ac109775bc818f9f04d031ffeeb5a0f36afb42c3ab9a45035b04a12e7c70478c19dde07752b';
|
// const access_token = '35baba3da5ac109775bc818f9f04d031ffeeb5a0f36afb42c3ab9a45035b04a12e7c70478c19dde07752b';
|
||||||
|
|
||||||
if (viewer_id && access_token) yield call(vkIframeAuth, { viewer_id, access_token });
|
// if (viewer_id && access_token) yield call(vkIframeAuth, { viewer_id, access_token });
|
||||||
|
if (viewer_id && access_token) yield put(iframeLoginVk({ viewer_id, access_token, auth_key }));
|
||||||
|
|
||||||
if (hash && /^#map/.test(hash)) {
|
if (hash && /^#map/.test(hash)) {
|
||||||
const [, newUrl] = hash.match(/^#map[:/?!](.*)$/);
|
const [, newUrl] = hash.match(/^#map[:/?!](.*)$/);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue