add other projects

This commit is contained in:
2025-11-04 15:00:49 -03:00
parent 80ff884ceb
commit 0b0ef528df
218 changed files with 58699 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import type { Route } from './+types'
import { createAuth, type User } from '@/lib/auth'
import { createSessionStorage } from '@/lib/session'
import { redirect } from 'react-router'
import type { OAuth2Strategy } from 'remix-auth-oauth2'
export async function loader({ request, context }: Route.LoaderArgs) {
const authenticator = createAuth(context.cloudflare.env)
const sessionStorage = createSessionStorage(context.cloudflare.env)
const session = await sessionStorage.getSession(request.headers.get('cookie'))
const user = session.get('user') as User
const strategy = authenticator.get<OAuth2Strategy<User>>('oidc')
if (user?.accessToken && strategy) {
await strategy.revokeToken(user.accessToken)
}
console.log(await sessionStorage.destroySession(session))
return redirect('/login', {
headers: { 'Set-Cookie': await sessionStorage.destroySession(session) }
})
}