feat: fixes and formatter

This commit is contained in:
2026-01-12 16:01:32 +01:00
parent 85c6084351
commit 11e632acff
353 changed files with 23315 additions and 27361 deletions
+20 -20
View File
@@ -1,40 +1,40 @@
import { getGlobal } from "reactn";
import { navigate } from "../navigation/NavigationService";
import { Routes } from "../navigation/Routes";
import { getGlobal } from 'reactn'
import { navigate } from '../navigation/NavigationService'
import { Routes } from '../navigation/Routes'
const redirectToRegister = () => {
try {
const activeRoute = getGlobal()?.activeRouteName;
const activeRoute = getGlobal()?.activeRouteName
if (activeRoute === Routes.Register) {
return;
return
}
} catch (error) {
console.warn("authRedirect: unable to read active route", error);
console.warn('authRedirect: unable to read active route', error)
}
navigate(Routes.Register);
};
navigate(Routes.Register)
}
export const ensureAuthenticated = (currentUID, options = {}) => {
const { onIntercept } = options || {};
const { onIntercept } = options || {}
if (currentUID) {
return true;
return true
}
try {
if (typeof onIntercept === "function") {
onIntercept();
if (typeof onIntercept === 'function') {
onIntercept()
}
} catch (error) {
console.warn("authRedirect: onIntercept error", error);
console.warn('authRedirect: onIntercept error', error)
}
redirectToRegister();
return false;
};
redirectToRegister()
return false
}
export const withAuthGuard = async (currentUID, handler, options = {}) => {
if (!ensureAuthenticated(currentUID, options)) {
return;
return
}
return handler?.();
};
return handler?.()
}
export default ensureAuthenticated;
export default ensureAuthenticated