new login
This commit is contained in:
parent
9e030c6431
commit
84d3f34315
@ -16,7 +16,6 @@ class Main extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
files: [],
|
||||
text: "",
|
||||
status: "",
|
||||
faq: false,
|
||||
@ -35,6 +34,9 @@ class Main extends Component {
|
||||
fetch(addr_prefix + "/api/photos").then(resp => resp.json()).then(json => {
|
||||
this.setState({photos: json})
|
||||
})
|
||||
fetch(addr_prefix + "/api/login_status").then(resp => resp.json()).then(json => {
|
||||
this.setState({login_status: json})
|
||||
})
|
||||
if(window.location.search){
|
||||
let searchParams = new URLSearchParams(window.location.search);
|
||||
for(const [key, value] of searchParams){
|
||||
@ -62,9 +64,6 @@ class Main extends Component {
|
||||
onHashChange(event){
|
||||
this.setState({page: window.location.hash, gallery_open: undefined})
|
||||
}
|
||||
handleChangeFiles(event) {
|
||||
this.setState({files: [...event.target.files]})
|
||||
}
|
||||
onSubmit(event){
|
||||
event.preventDefault();
|
||||
let form = document.getElementById("form");
|
||||
@ -153,6 +152,11 @@ class Main extends Component {
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#payment">Platba</a>
|
||||
</li>
|
||||
{!this.state.login_status &&
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#login">Přihlašování</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
@ -164,10 +168,18 @@ class Main extends Component {
|
||||
<div class="absolute container-fluid alert alert-danger">
|
||||
{this.state.text}
|
||||
</div>}
|
||||
{this.state.page == "#login" &&
|
||||
<div>
|
||||
<form id="form" action="/api/login" class="container" onSubmit={(e) => this.onSubmit(e)}>
|
||||
<label>Přihlašovací email:<input name="email" type="text" /></label>
|
||||
<button type="submit" class="btn btn-primary">Přihlásit</button> <b>progress: {(this.state.uploadProgress * 100).toFixed(1)}%</b>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
{this.state.page == "#upload_files" &&
|
||||
<div>
|
||||
<form id="form" action="/api/upload_files" class="container" onSubmit={(e) => this.onSubmit(e)}>
|
||||
<label>Zvolte soubory <input type="file" name="files" accept=".jpg,.png,.webp,.webm,.avi,.mkv,.mp4" multiple={true} onChange={(e)=> this.handleChangeFiles.bind(this)(e)}/></label>
|
||||
<label>Zvolte soubory <input type="file" name="files" accept=".jpg,.png,.webp,.webm,.avi,.mkv,.mp4" multiple={true}/></label>
|
||||
<button type="submit" class="btn btn-primary">Nahrát</button> <b>progress: {(this.state.uploadProgress * 100).toFixed(1)}%</b>
|
||||
</form>
|
||||
</div>}
|
||||
|
Loading…
x
Reference in New Issue
Block a user