Merge pull request #6 from atridadl/dev

1.0.6 - Competently actualize resource-sucking vortals
🐛 Sending room links to signed out users now redirects to the original link once the user signs in (In nerd speak: I added a proper callback URL for signin requests)
This commit is contained in:
Atridad Lahiji 2023-05-30 22:19:48 -06:00 committed by GitHub
commit 8a0740c52a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "sprintpadawan", "name": "sprintpadawan",
"version": "1.0.5", "version": "1.0.6",
"description": "Plan. Sprint. Repeat.", "description": "Plan. Sprint. Repeat.",
"private": true, "private": true,
"scripts": { "scripts": {

View file

@ -68,7 +68,9 @@ const Navbar: React.FC<NavbarProps> = ({ title }) => {
</li> </li>
)} )}
<li> <li>
<a onClick={() => void signOut()}>Sign Out</a> <a onClick={() => void signOut({ callbackUrl: "/" })}>
Sign Out
</a>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -18,7 +18,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
if (!session) { if (!session) {
return { return {
redirect: { redirect: {
destination: "/", destination: `/api/auth/signin?callbackUrl=${ctx.resolvedUrl}`,
permanent: false, permanent: false,
}, },
}; };

View file

@ -37,7 +37,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
if (!session) { if (!session) {
return { return {
redirect: { redirect: {
destination: "/", destination: `/api/auth/signin?callbackUrl=${ctx.resolvedUrl}`,
permanent: false, permanent: false,
}, },
}; };

View file

@ -12,6 +12,7 @@ import { prisma } from "~/server/db";
import type { Role } from "~/utils/types"; import type { Role } from "~/utils/types";
import { sendMail } from "fms-ts"; import { sendMail } from "fms-ts";
import { cacheClient, deleteFromCache } from "redicache-ts"; import { cacheClient, deleteFromCache } from "redicache-ts";
import { redirect } from "next/navigation";
const client = cacheClient(env.REDIS_URL); const client = cacheClient(env.REDIS_URL);
@ -75,7 +76,7 @@ export const authOptions: NextAuthOptions = {
async signIn({}) { async signIn({}) {
await deleteFromCache(client, env.APP_ENV, `kv_userlist_admin`); await deleteFromCache(client, env.APP_ENV, `kv_userlist_admin`);
}, },
async signOut({}) { async signOut() {
await deleteFromCache(client, env.APP_ENV, `kv_userlist_admin`); await deleteFromCache(client, env.APP_ENV, `kv_userlist_admin`);
}, },
}, },