Skip to content

Commit

Permalink
firebase hosting設定
Browse files Browse the repository at this point in the history
  • Loading branch information
cola119 committed Jun 8, 2019
1 parent 7b11de6 commit e1fed56
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
12 changes: 7 additions & 5 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
}
}
2 changes: 1 addition & 1 deletion src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

const App: React.FC = () => {
return <div>aa</div>;
return <div>aaaaa</div>;
};

export default App;
8 changes: 6 additions & 2 deletions src/components/Molecules/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import React, { useState } from 'react';
import TextInput from '../Atoms/TextInput';
import { Button } from '@material-ui/core';

const LoginForm: React.FC<{}> = () => {
interface IProps {
url: string;
}

const LoginForm: React.FC<IProps> = props => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');

const changeEmail = (e: React.ChangeEvent<HTMLInputElement>) => setEmail(e.target.value);
const changePassword = (e: React.ChangeEvent<HTMLInputElement>) => setPassword(e.target.value);

return (
<form action="https://trecamp-server.web.app/login" method="POST">
<form action={props.url} method="POST">
<TextInput
name="email"
type="email"
Expand Down
13 changes: 12 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@ import * as serviceWorker from './serviceWorker';
import LoginForm from './components/Molecules/LoginForm';
import CssBaseline from '@material-ui/core/CssBaseline';

const renderLoginForm = (url: string) => () => <LoginForm url={url} />;

ReactDOM.render(
<Router>
<CssBaseline />
<Route path="/" exact={true} component={App} />
<Route path="/login" exact={true} component={LoginForm} />
<Route
path="/login"
exact={true}
render={renderLoginForm('https://fe31b056.ngrok.io/trecamp-server/us-central1/api/login')}
/>
<Route
path="/login_production"
exact={true}
render={renderLoginForm('https://trecamp-server.web.app/login')}
/>
</Router>,
document.getElementById('root')
);
Expand Down

0 comments on commit e1fed56

Please sign in to comment.