Optimize first and update auto create user logic.

This commit is contained in:
Kenshin 2018-08-27 14:27:55 +08:00
parent 2d03bcc726
commit 328e8547ca
2 changed files with 5 additions and 3 deletions

View File

@ -50,11 +50,10 @@ export default class AccountOpt extends React.Component {
watch.SendMessage( "option", true );
}, storage.simpread );
}
window.location.hash && window.location.hash.startsWith( "#firstload" ) && this.add();
( this.props.load.first || this.props.load.update ) && this.add();
}
add() {
storage.user.uid = run.ID( "user" );
$.ajax({
url : storage.service + "/users/service/add/",
method: "POST",

View File

@ -36,6 +36,7 @@ import * as welc from 'welcome';
import PureRead from 'puread';
let tabsItemID = 0,
loadState = { first: false, update: false },
website_sync = false; // when first and update checked versions.json
/**
@ -135,8 +136,10 @@ function vernotify( first ) {
new Notify().Render( "简悦 版本提示", msg );
loadState = { first: true };
if ( hash.startsWith( "#update?ver=" )) {
watch.SendMessage( "version", true );
loadState = { first: true, update: true };
welcomeRender( false, version );
}
website_sync = true;
@ -232,7 +235,7 @@ function tabsRender( color ) {
</section>
<section><Unrdist list={ storage.unrdist.map( item => { return { ...item }} ) } /></section>
<section style={{ 'padding': '0;' }}>
<AccountOps user={ storage.user } />
<AccountOps user={ storage.user } load={ loadState } />
</section>
<section style={{ 'padding': '0;' }}><About option={ storage.option } site={ storage.simpread.sites.length } statistics={ storage.simpread.statistics } onClick={t=>welcomeRender(true)}/></section>
</Tabs>,