Skip to content

Instantly share code, notes, and snippets.

@mykhas
Created April 10, 2016 22:04
Show Gist options
  • Save mykhas/a55c83b42218e3e079ee0ae5d36cd2e6 to your computer and use it in GitHub Desktop.
Save mykhas/a55c83b42218e3e079ee0ae5d36cd2e6 to your computer and use it in GitHub Desktop.
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Login from './Login';
import fetch from '../../core/fetch';
export const path = '/login';
export const action = async (state) => {
const response = await fetch('/graphql?query={me{id,email}}', {
credentials: 'same-origin',
});
const { data } = await response.json();
const title = 'Log In';
state.context.onSetTitle(title);
return <Login title={title} me={data.me} />;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment