mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-02-18 03:11:31 +01:00
fix login/logout state transition weirdness
This commit is contained in:
parent
a1d184eac4
commit
87f28dacbf
@ -29,12 +29,16 @@ const { Error } = require("../error");
|
||||
|
||||
module.exports = function Authorization({ App }) {
|
||||
const loginState = Redux.useSelector((state) => state.oauth.loginState);
|
||||
const { isLoading, isSuccess, data: account, error } = query.useVerifyCredentialsQuery();
|
||||
const [hasStoredLogin] = React.useState(loginState != "none" && loginState != "logout");
|
||||
|
||||
const { isLoading, isSuccess, data: account, error } = query.useVerifyCredentialsQuery(undefined, {
|
||||
skip: loginState == "none" || loginState == "logout"
|
||||
});
|
||||
|
||||
let showLogin = true;
|
||||
let content = null;
|
||||
|
||||
if (isLoading && loginState != "none") {
|
||||
if (isLoading && hasStoredLogin) {
|
||||
showLogin = false;
|
||||
|
||||
let loadingInfo;
|
||||
@ -51,7 +55,10 @@ module.exports = function Authorization({ App }) {
|
||||
);
|
||||
} else if (error != undefined) {
|
||||
content = (
|
||||
<Error error={error} />
|
||||
<div>
|
||||
<Error error={error} />
|
||||
You can attempt logging in again below:
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ const endpoints = (build) => ({
|
||||
|
||||
if (app == undefined || app.client_id == undefined) {
|
||||
throw {
|
||||
message: "No stored registration data, can't finish login flow. Please try again:"
|
||||
message: "No stored registration data, can't finish login flow."
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ module.exports = createSlice({
|
||||
remove: (state, { _payload }) => {
|
||||
delete state.token;
|
||||
delete state.registration;
|
||||
state.loginState = "none";
|
||||
state.loginState = "logout";
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user