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