mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-29 18:59:20 +01:00
fix: cache is not exportet from react (#417)
* fix: cache is not exportet from react * fix: format issue * fix: type issue
This commit is contained in:
@@ -7,7 +7,7 @@ import "@mantine/core/styles.css";
|
||||
|
||||
import { ColorSchemeScript, createTheme, MantineProvider } from "@mantine/core";
|
||||
|
||||
import { auth } from "@homarr/auth";
|
||||
import { auth } from "@homarr/auth/next";
|
||||
import { ModalProvider } from "@homarr/modals";
|
||||
import { Notifications } from "@homarr/notifications";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
|
||||
import { appRouter, createTRPCContext } from "@homarr/api";
|
||||
import { auth } from "@homarr/auth";
|
||||
import { auth } from "@homarr/auth/next";
|
||||
import { logger } from "@homarr/log";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { auth } from "@homarr/auth";
|
||||
import { auth } from "@homarr/auth/next";
|
||||
import type { BoardPermissionsProps } from "@homarr/auth/shared";
|
||||
import { constructBoardPermissions } from "@homarr/auth/shared";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AvatarProps, MantineSize } from "@mantine/core";
|
||||
import { Avatar } from "@mantine/core";
|
||||
|
||||
import { auth } from "@homarr/auth";
|
||||
import { auth } from "@homarr/auth/next";
|
||||
|
||||
interface UserAvatarProps {
|
||||
size: MantineSize;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cache } from "react";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
import { createCaller, createTRPCContext } from "@homarr/api";
|
||||
import { auth } from "@homarr/auth";
|
||||
import { auth } from "@homarr/auth/next";
|
||||
|
||||
/**
|
||||
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { cache } from "react";
|
||||
import type { DefaultSession } from "@auth/core/types";
|
||||
|
||||
import { createConfiguration } from "./configuration";
|
||||
@@ -17,11 +16,5 @@ export * from "./security";
|
||||
|
||||
export const createHandlers = (isCredentialsRequest: boolean) =>
|
||||
createConfiguration(isCredentialsRequest);
|
||||
const { auth: defaultAuth } = createConfiguration(false);
|
||||
|
||||
/**
|
||||
* This is the main way to get session data for your RSCs.
|
||||
* This will de-duplicate all calls to next-auth's default `auth()` function and only call it once per request
|
||||
*/
|
||||
export const auth = cache(defaultAuth);
|
||||
export { getSessionFromToken, sessionTokenCookieName } from "./session";
|
||||
|
||||
11
packages/auth/next.ts
Normal file
11
packages/auth/next.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { cache } from "react";
|
||||
|
||||
import { createConfiguration } from "./configuration";
|
||||
|
||||
const { auth: defaultAuth } = createConfiguration(false);
|
||||
|
||||
/**
|
||||
* This is the main way to get session data for your RSCs.
|
||||
* This will de-duplicate all calls to next-auth's default `auth()` function and only call it once per request
|
||||
*/
|
||||
export const auth = cache(defaultAuth);
|
||||
@@ -4,6 +4,7 @@
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
"./next": "./next.ts",
|
||||
"./security": "./security.ts",
|
||||
"./client": "./client.ts",
|
||||
"./shared": "./shared.ts",
|
||||
|
||||
Reference in New Issue
Block a user