Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Move auth utils inline (#73355)

Fraser4f6989171fe4
diff --git a/frontend/src/metabase/auth/actions.ts b/frontend/src/metabase/auth/actions.ts
index 8fb369e9fe5..d5f45b6747e 100644
--- a/frontend/src/metabase/auth/actions.ts
+++ b/frontend/src/metabase/auth/actions.ts
@@ -10,8 +10,8 @@ import { getSetting } from "metabase/selectors/settings";
import { getUser } from "metabase/selectors/user";
import { SessionApi, UtilApi } from "metabase/services";
import * as Urls from "metabase/urls";
-import { deleteSession, initiateSLO } from "metabase/utils/auth";
import { isSmallScreen, reload } from "metabase/utils/dom";
+import { isResourceNotFoundError } from "metabase/utils/errors";
import { loadLocalization } from "metabase/utils/i18n";
import { passwordComplexityDescription } from "metabase/utils/password";
@@ -178,3 +178,23 @@ export const validatePassword = async (password: string) => {
return getIn(error, ["data", "errors", "password"]);
}
};
+
+const initiateSLO = async () => {
+ try {
+ return await SessionApi.slo();
+ } catch (error) {
+ if (!isResourceNotFoundError(error)) {
+ console.error("Problem clearing session", error);
+ }
+ }
+};
+
+export const deleteSession = async () => {
+ try {
+ await SessionApi.delete();
+ } catch (error) {
+ if (!isResourceNotFoundError(error)) {
+ console.error("Problem clearing session", error);
+ }
+ }
+};
diff --git a/frontend/src/metabase/utils/auth.ts b/frontend/src/metabase/utils/auth.ts
deleted file mode 100644
index ef32ca9d395..00000000000
--- a/frontend/src/metabase/utils/auth.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { SessionApi } from "metabase/services";
-import { isResourceNotFoundError } from "metabase/utils/errors/messages";
-
-export const deleteSession = async () => {
- try {
- await SessionApi.delete();
- } catch (error) {
- if (!isResourceNotFoundError(error)) {
- console.error("Problem clearing session", error);
- }
- }
-};
-
-export const initiateSLO = async () => {
- try {
- return await SessionApi.slo();
- } catch (error) {
- if (!isResourceNotFoundError(error)) {
- console.error("Problem clearing session", error);
- }
- }
-};