File tree Expand file tree Collapse file tree
app/(with-contexts)/(with-layout)/logout Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,18 +5,28 @@ import { LOGOUT, LOGOUT_MESSAGE } from "@ui-config/strings";
55import { useContext } from "react" ;
66import { ThemeContext } from "@components/contexts" ;
77import { authClient } from "@/lib/auth-client" ;
8+ import { useToast } from "@courselit/components-library" ;
89
910export default function ClientSide ( ) {
1011 const { theme } = useContext ( ThemeContext ) ;
12+ const { toast } = useToast ( ) ;
1113
1214 const handleLogout = async ( ) => {
13- await authClient . signOut ( {
15+ const { error } = await authClient . signOut ( {
1416 fetchOptions : {
1517 onSuccess : ( ) => {
1618 window . location . href = "/login" ;
1719 } ,
1820 } ,
1921 } ) ;
22+
23+ if ( error ) {
24+ toast ( {
25+ title : "Error" ,
26+ description : error ?. message ,
27+ variant : "destructive" ,
28+ } ) ;
29+ }
2030 } ;
2131
2232 return (
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { responses } from "@/config/strings";
1010import { mongodbAdapter } from "@/ba-multitenant-adapter" ;
1111import { updateUserAfterCreationViaAuth } from "./graphql/users/logic" ;
1212import UserModel from "@models/User" ;
13+ import { getBackendAddress } from "./app/actions" ;
1314
1415const client = new MongoClient ( process . env . DB_CONNECTION_STRING || "" ) ;
1516const db = client . db ( ) ;
@@ -88,6 +89,10 @@ const config: any = {
8889 } ,
8990 } ,
9091 } ,
92+ trustedOrigins : async ( request : Request ) => {
93+ const backendAddress = await getBackendAddress ( request . headers ) ;
94+ return [ backendAddress ] ;
95+ } ,
9196} ;
9297
9398if ( process . env . SESSION_COOKIE_CACHE_MAX_AGE ) {
Original file line number Diff line number Diff line change 11/// <reference types="next" />
22/// <reference types="next/image-types/global" />
3- import "./.next/types/routes.d.ts" ;
3+ import "./.next/dev/ types/routes.d.ts" ;
44
55// NOTE: This file should not be edited
66// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
You can’t perform that action at this time.
0 commit comments