migrate config away from localStorage; ensure config is properly loaded on access token auth
This commit is contained in:
@@ -3,7 +3,7 @@ import { AuthProvider, HttpError, Options, fetchUtils } from "react-admin";
|
||||
import storage from "../storage";
|
||||
import { MatrixError, displayError } from "../components/error";
|
||||
import { fetchAuthenticatedMedia } from "../utils/fetchMedia";
|
||||
import { ClearConfig } from "../components/config";
|
||||
import { FetchConfig, ClearConfig } from "../components/config";
|
||||
|
||||
const authProvider: AuthProvider = {
|
||||
// called when the user attempts to log in
|
||||
@@ -82,6 +82,11 @@ const authProvider: AuthProvider = {
|
||||
storage.setItem("device_id", json.device_id);
|
||||
storage.setItem("login_type", accessToken ? "accessToken" : "credentials");
|
||||
|
||||
// when doing access token auth, config is not fetched, so we need to do it here
|
||||
if (accessToken) {
|
||||
await FetchConfig();
|
||||
}
|
||||
|
||||
return Promise.resolve({redirectTo: "/"});
|
||||
} catch(err) {
|
||||
const error = err as HttpError;
|
||||
|
||||
Reference in New Issue
Block a user