console: move back to metadata apis for verifying login

GitOrigin-RevId: 56581f7f05f8c69d8b2d38c3719057b489132437
This commit is contained in:
Aleksandra Sikora 2021-02-25 18:30:34 +01:00 committed by hasura-bot
parent 06a129d5c0
commit 71d5955654

View File

@ -5,6 +5,7 @@ import { ADMIN_SECRET_HEADER_KEY, CLI_CONSOLE_MODE } from '../../constants';
import requestAction from '../../utils/requestAction'; import requestAction from '../../utils/requestAction';
import { Dispatch } from '../../types'; import { Dispatch } from '../../types';
import globals from '../../Globals'; import globals from '../../Globals';
import { inconsistentObjectsQuery } from '../../metadata/queryUtils';
type VerifyLoginOptions = { type VerifyLoginOptions = {
adminSecret: string; adminSecret: string;
@ -22,14 +23,15 @@ export const verifyLogin = ({
dispatch, dispatch,
}: VerifyLoginOptions) => { }: VerifyLoginOptions) => {
const options: RequestInit = { const options: RequestInit = {
method: 'GET', method: 'POST',
credentials: globalCookiePolicy, credentials: globalCookiePolicy,
headers: { headers: {
[ADMIN_SECRET_HEADER_KEY]: adminSecret, [ADMIN_SECRET_HEADER_KEY]: adminSecret,
'content-type': 'application/json', 'content-type': 'application/json',
}, },
body: JSON.stringify(inconsistentObjectsQuery),
}; };
return dispatch(requestAction(Endpoints.serverConfig, options)).then( return dispatch(requestAction(Endpoints.metadata, options)).then(
() => { () => {
if (adminSecret) { if (adminSecret) {
if (globals.consoleMode !== CLI_CONSOLE_MODE) { if (globals.consoleMode !== CLI_CONSOLE_MODE) {