debug, purge local db

This commit is contained in:
Daniel
2018-07-12 20:19:35 -04:00
parent b8fe33f1ea
commit b9b34212ec
4 changed files with 37 additions and 27 deletions

File diff suppressed because one or more lines are too long

View File

@@ -101,6 +101,10 @@ class CollectionDB {
});
};
}
purgeDB() {
this.db.deleteDatabase();
}
}
class API {
@@ -170,6 +174,21 @@ class API {
}
}
// Input format
// [{cards: 'attacks'}, {portal: 'attacks'}]
async buildCollection(input) {
return await Promise.all(input.map((item) => {
return new Promise((resolve, reject) => {
if ('cards' in item)
return this.cards.setupType(item.cards, resolve);
if ('portal' in item)
return this.portal.setupType(item.portal, resolve);
console.error('cards or portal');
return reject();
});
}));
}
get tribes() {
return ["Danian", "Generic", "Mipedian", "OverWorld", "UnderWorld"];
}
@@ -194,19 +213,11 @@ class API {
};
}
// Input format
// [{cards: 'attacks'}, {portal: 'attacks'}]
async buildCollection(input) {
return await Promise.all(input.map((item) => {
return new Promise((resolve, reject) => {
if ('cards' in item)
return this.cards.setupType(item.cards, resolve);
if ('portal' in item)
return this.portal.setupType(item.portal, resolve);
console.error('cards or portal');
return reject();
});
}));
purgeDB()
{
this.cards.purgeDB();
this.portal.purgeDB();
window.location.reload();
}
}

View File

@@ -57,18 +57,16 @@ export default class Home extends React.Component {
}
return (
<div style={{textAlign: 'left'}}>
<p>Showing page {this.p} of {numpages} {prev()} {next()}</p>
<p>
Entries per page:&nbsp;
{/*<input type="text" style={{width: '40px'}} value={this.n}
onChange={(event) => {let x = event.target.value; if (!isNaN(x)) this.n=x;}
/>*/}
<input type="button" value="5" disabled={this.n=="5"} onClick={(e) => this.n=e.target.value} />&nbsp;
<input type="button" value="10" disabled={this.n=="10"} onClick={(e) => this.n=e.target.value} />&nbsp;
<input type="button" value="20" disabled={this.n=="20"} onClick={(e) => this.n=e.target.value} />&nbsp;
<input type="button" value="50" disabled={this.n=="50"} onClick={(e) => this.n=e.target.value} />
</p>
<div style={{textAlign: 'left'}} className="entries">
{this.content.length} results - page {this.p} of {numpages} {prev()} {next()}
<br/>Entries per page:&nbsp;
{/*<input type="text" style={{width: '40px'}} value={this.n}
onChange={(event) => {let x = event.target.value; if (!isNaN(x)) this.n=x;}
/>*/}
<input type="button" value="5" disabled={this.n=="5"} onClick={(e) => this.n=e.target.value} />&nbsp;
<input type="button" value="10" disabled={this.n=="10"} onClick={(e) => this.n=e.target.value} />&nbsp;
<input type="button" value="20" disabled={this.n=="20"} onClick={(e) => this.n=e.target.value} />&nbsp;
<input type="button" value="50" disabled={this.n=="50"} onClick={(e) => this.n=e.target.value} />
</div>
);
};

View File

@@ -5,6 +5,7 @@ import {observer, inject} from 'mobx-react';
import s from '../styles/app.style';
/* Components */
import API from './SpreadsheetData';
import {PageNotFound, UnderConstruction, Donate} from './Snippets';
import EnterTheCode from './entercode/index';
import Collection from './collection/index';
@@ -137,7 +138,7 @@ function Base(props) {
</div>
</div>
<div className="footer-language">
<a href="javascript:showLanguageSelection();" className="page-options" title="Change Language">
<a href="" onClick={(e) => {API.purgeDB(); return;}} className="page-options" title="Change Language">
<img src="/src/img/flag_usa_.gif" alt="English (Change Language)" width="40" height="27"/>
<br />English (Change Language)
</a>