@mikandev/next-discord-auth 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +0 -13
- package/dist/server-actions.js +10 -0
- package/dist/types/client.d.ts +0 -4
- package/dist/types/server-actions.d.ts +4 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import {} from "./index";
|
|
4
|
-
import { getSession } from "./server-actions";
|
|
5
4
|
import { createContext, useContext } from "react";
|
|
6
5
|
import useSWR from "swr";
|
|
7
6
|
const UserInfoContext = createContext(undefined);
|
|
@@ -32,15 +31,3 @@ export function useUserInfo() {
|
|
|
32
31
|
}
|
|
33
32
|
return context;
|
|
34
33
|
}
|
|
35
|
-
export const createSessionProviderRoute = () => {
|
|
36
|
-
return async (_request) => {
|
|
37
|
-
const session = await getSession();
|
|
38
|
-
if (!session) {
|
|
39
|
-
return Response.json({ error: "Not logged in" }, { status: 401 });
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const { accessToken, refreshToken, ...clientSession } = session;
|
|
43
|
-
return Response.json(clientSession);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
};
|
package/dist/server-actions.js
CHANGED
|
@@ -71,3 +71,13 @@ export const signOut = async () => {
|
|
|
71
71
|
cookieStore.delete("AUTH_SESSION");
|
|
72
72
|
return Response.json({ message: "Signed out successfully" }, { status: 200 });
|
|
73
73
|
};
|
|
74
|
+
export const createSessionProviderRoute = async (_request) => {
|
|
75
|
+
const session = await getSession();
|
|
76
|
+
if (!session) {
|
|
77
|
+
return Response.json({ error: "Not logged in" }, { status: 401 });
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const { accessToken, refreshToken, ...clientSession } = session;
|
|
81
|
+
return Response.json(clientSession);
|
|
82
|
+
}
|
|
83
|
+
};
|
package/dist/types/client.d.ts
CHANGED
|
@@ -5,3 +5,7 @@ export declare function getSession(): Promise<Session | null>;
|
|
|
5
5
|
export declare function signIn(): Promise<Response>;
|
|
6
6
|
|
|
7
7
|
export declare function signOut(): Promise<Response>;
|
|
8
|
+
|
|
9
|
+
export declare function createSessionProviderRoute(
|
|
10
|
+
request: Request,
|
|
11
|
+
): Promise<Response>;
|