fix(fe/state_updater): 1.disable syncing remote in deleting uploading to avoid lost uploading 2.fix incorrect ret code 3.move getCpatchaID out of initAuth
This commit is contained in:
parent
e43ea8507c
commit
3be9343e52
2 changed files with 10 additions and 8 deletions
|
@ -67,7 +67,6 @@ export class UploadingsPanel extends React.Component<Props, State, {}> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const statuses = await Promise.all([
|
const statuses = await Promise.all([
|
||||||
updater().refreshUploadings(),
|
|
||||||
updater().self(),
|
updater().self(),
|
||||||
]);
|
]);
|
||||||
if (statuses.join("") !== "") {
|
if (statuses.join("") !== "") {
|
||||||
|
|
|
@ -71,6 +71,7 @@ export class Updater {
|
||||||
this.props.filesInfo.dirPath.join("/"),
|
this.props.filesInfo.dirPath.join("/"),
|
||||||
file.name
|
file.name
|
||||||
);
|
);
|
||||||
|
|
||||||
const status = Up().add(file, filePath);
|
const status = Up().add(file, filePath);
|
||||||
if (status !== "") {
|
if (status !== "") {
|
||||||
return status;
|
return status;
|
||||||
|
@ -87,6 +88,8 @@ export class Updater {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setUploads(Up().list());
|
||||||
|
|
||||||
const resp = await this.filesClient.deleteUploading(filePath);
|
const resp = await this.filesClient.deleteUploading(filePath);
|
||||||
return resp.status === 200 ? "" : errServer;
|
return resp.status === 200 ? "" : errServer;
|
||||||
};
|
};
|
||||||
|
@ -534,11 +537,6 @@ export class Updater {
|
||||||
};
|
};
|
||||||
|
|
||||||
initAuth = async (): Promise<string> => {
|
initAuth = async (): Promise<string> => {
|
||||||
const getCapStatus = await this.getCaptchaID();
|
|
||||||
if (getCapStatus !== "") {
|
|
||||||
return getCapStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isAuthedStatus = await this.syncIsAuthed();
|
const isAuthedStatus = await this.syncIsAuthed();
|
||||||
if (isAuthedStatus !== "") {
|
if (isAuthedStatus !== "") {
|
||||||
return isAuthedStatus;
|
return isAuthedStatus;
|
||||||
|
@ -554,6 +552,11 @@ export class Updater {
|
||||||
|
|
||||||
initAll = async (params: URLSearchParams): Promise<string> => {
|
initAll = async (params: URLSearchParams): Promise<string> => {
|
||||||
const paramMap = await this.initParams(params);
|
const paramMap = await this.initParams(params);
|
||||||
|
const getCapStatus = await this.getCaptchaID();
|
||||||
|
if (getCapStatus !== "") {
|
||||||
|
return getCapStatus;
|
||||||
|
}
|
||||||
|
|
||||||
const authStatus = await this.initAuth();
|
const authStatus = await this.initAuth();
|
||||||
if (authStatus !== "") {
|
if (authStatus !== "") {
|
||||||
return authStatus;
|
return authStatus;
|
||||||
|
@ -638,7 +641,7 @@ export class Updater {
|
||||||
this.props.login.quota = resp.data.quota;
|
this.props.login.quota = resp.data.quota;
|
||||||
this.props.login.preferences = resp.data.preferences;
|
this.props.login.preferences = resp.data.preferences;
|
||||||
return "";
|
return "";
|
||||||
} else if (resp.status === 401) {
|
} else if (resp.status === 403) {
|
||||||
this.resetUser();
|
this.resetUser();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -746,7 +749,7 @@ export class Updater {
|
||||||
const resp = await this.usersClient.isAuthed();
|
const resp = await this.usersClient.isAuthed();
|
||||||
if (resp.status !== 200) {
|
if (resp.status !== 200) {
|
||||||
this.resetUser();
|
this.resetUser();
|
||||||
return resp.status === 401 ? "" : errServer;
|
return resp.status === 403 ? "" : errServer;
|
||||||
}
|
}
|
||||||
this.props.login.authed = true;
|
this.props.login.authed = true;
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue