mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-30 14:38:57 +02:00
Update major dependencies (#408)
This commit is contained in:
parent
6332d6459f
commit
e845d36c51
30 changed files with 1294 additions and 775 deletions
|
@ -1,4 +1,9 @@
|
|||
import { IronSessionOptions, sealData, unsealData } from "iron-session";
|
||||
import {
|
||||
IronSession,
|
||||
IronSessionOptions,
|
||||
sealData,
|
||||
unsealData,
|
||||
} from "iron-session";
|
||||
import { withIronSessionApiRoute, withIronSessionSsr } from "iron-session/next";
|
||||
import { GetServerSideProps, NextApiHandler } from "next";
|
||||
|
||||
|
@ -96,3 +101,15 @@ export const mergeGuestsIntoUser = async (
|
|||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const getCurrentUser = async (
|
||||
session: IronSession,
|
||||
): Promise<{ isGuest: boolean; id: string }> => {
|
||||
const user = session.user;
|
||||
|
||||
if (!user) {
|
||||
throw new Error("Tried to get user but no user found.");
|
||||
}
|
||||
|
||||
return user;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue