Update major dependencies (#408)

This commit is contained in:
Luke Vella 2023-01-20 10:43:48 +00:00 committed by GitHub
parent 6332d6459f
commit e845d36c51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 1294 additions and 775 deletions

View file

@ -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;
};