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([
|
||||
updater().refreshUploadings(),
|
||||
updater().self(),
|
||||
]);
|
||||
if (statuses.join("") !== "") {
|
||||
|
|
|
@ -71,6 +71,7 @@ export class Updater {
|
|||
this.props.filesInfo.dirPath.join("/"),
|
||||
file.name
|
||||
);
|
||||
|
||||
const status = Up().add(file, filePath);
|
||||
if (status !== "") {
|
||||
return status;
|
||||
|
@ -87,6 +88,8 @@ export class Updater {
|
|||
return status;
|
||||
}
|
||||
|
||||
this.setUploads(Up().list());
|
||||
|
||||
const resp = await this.filesClient.deleteUploading(filePath);
|
||||
return resp.status === 200 ? "" : errServer;
|
||||
};
|
||||
|
@ -534,11 +537,6 @@ export class Updater {
|
|||
};
|
||||
|
||||
initAuth = async (): Promise<string> => {
|
||||
const getCapStatus = await this.getCaptchaID();
|
||||
if (getCapStatus !== "") {
|
||||
return getCapStatus;
|
||||
}
|
||||
|
||||
const isAuthedStatus = await this.syncIsAuthed();
|
||||
if (isAuthedStatus !== "") {
|
||||
return isAuthedStatus;
|
||||
|
@ -554,6 +552,11 @@ export class Updater {
|
|||
|
||||
initAll = async (params: URLSearchParams): Promise<string> => {
|
||||
const paramMap = await this.initParams(params);
|
||||
const getCapStatus = await this.getCaptchaID();
|
||||
if (getCapStatus !== "") {
|
||||
return getCapStatus;
|
||||
}
|
||||
|
||||
const authStatus = await this.initAuth();
|
||||
if (authStatus !== "") {
|
||||
return authStatus;
|
||||
|
@ -638,7 +641,7 @@ export class Updater {
|
|||
this.props.login.quota = resp.data.quota;
|
||||
this.props.login.preferences = resp.data.preferences;
|
||||
return "";
|
||||
} else if (resp.status === 401) {
|
||||
} else if (resp.status === 403) {
|
||||
this.resetUser();
|
||||
return "";
|
||||
}
|
||||
|
@ -746,7 +749,7 @@ export class Updater {
|
|||
const resp = await this.usersClient.isAuthed();
|
||||
if (resp.status !== 200) {
|
||||
this.resetUser();
|
||||
return resp.status === 401 ? "" : errServer;
|
||||
return resp.status === 403 ? "" : errServer;
|
||||
}
|
||||
this.props.login.authed = true;
|
||||
return "";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue