Loading...
;
+ }
+
+ if (!outletContext.currentUser) {
+ return
@@ -94,45 +136,31 @@ export default function Connections() {
- {PROVIDERS.map((p) => {
- if (
- !outletContext.currentUser ||
- !outletContext.currentUser.username
- )
- throw new Error("User not logged in");
- return (
- c.provider.toLowerCase() === p.identifier
- )}
- connectionLink={buildAuthLoginUrl({
- type: p.identifier,
- authBaseDomain: publicEnvVariables.VITE_AUTH_BASE_URL || "",
- authReturnDomain:
- publicEnvVariables.VITE_AUTH_RETURN_URL || "",
- })}
- disconnectFunction={(p) => {
- if (
- !outletContext.currentUser ||
- !outletContext.currentUser.username
- )
- throw new Error("User not logged in");
- return onSubmit({
- params: {
- provider: p,
- },
- config: outletContext.requestConfig,
- queryParams: {},
- data: { provider: p },
- });
- }}
- />
- );
- })}
+ {PROVIDERS.map((provider) => (
+ {
+ disconnectingProviderRef.current = provider;
+ return onSubmit({
+ params: { provider },
+ config: outletContext.requestConfig,
+ queryParams: {},
+ data: { provider },
+ });
+ }}
+ />
+ ))}
diff --git a/apps/cyberstorm-remix/app/settings/user/Settings.tsx b/apps/cyberstorm-remix/app/settings/user/Settings.tsx
index 6b05b28fb..54ef6ac9e 100644
--- a/apps/cyberstorm-remix/app/settings/user/Settings.tsx
+++ b/apps/cyberstorm-remix/app/settings/user/Settings.tsx
@@ -1,56 +1,24 @@
+import "./Settings.css";
import { Outlet, useLocation, useOutletContext } from "react-router";
import { NewLink, Tabs } from "@thunderstore/cyberstorm";
import { PageHeader } from "~/commonComponents/PageHeader/PageHeader";
-
import { type OutletContextShape } from "../../root";
-import "./Settings.css";
-import { NotLoggedIn } from "~/commonComponents/NotLoggedIn/NotLoggedIn";
-
-// export async function clientLoader() {
-// const _storage = new NamespacedStorageManager(SESSION_STORAGE_KEY);
-// const currentUser = getSessionCurrentUser(_storage, true, undefined, () => {
-// clearSession(_storage);
-// throw new Response("Your session has expired, please log in again", {
-// status: 401,
-// });
-// // redirect("/");
-// });
-
-// if (
-// !currentUser.username ||
-// (currentUser.username && currentUser.username === "")
-// ) {
-// clearSession(_storage);
-// throw new Response("Not logged in.", { status: 401 });
-// } else {
-// return {
-// currentUser: currentUser as typeof currentUserSchema._type,
-// };
-// }
-// }
-// export function HydrateFallback() {
-// return Loading...
;
-// }
+export default function UserSettings() {
+ const context = useOutletContext