Skip to content

Commit cc89e0a

Browse files
committed
fix auth
1 parent caafe21 commit cc89e0a

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

convex/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ossStats } from './stats'
22
import { httpRouter } from 'convex/server'
33
import { betterAuthComponent } from './auth'
4-
import { createAuth } from '../src/server/auth'
4+
import { createAuth } from '../src/server/auth.server'
55

66
const http = httpRouter()
77

src/routes/_libraries/login.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import { FaGithub, FaGoogle } from 'react-icons/fa'
44
import splashLightImg from '~/images/splash-light.png'
55
import splashDarkImg from '~/images/splash-dark.png'
66
import { redirect } from '@tanstack/react-router'
7+
import { api } from 'convex/_generated/api'
8+
import { convexQuery } from '@convex-dev/react-query'
79

810
export const Route = createFileRoute({
911
component: LoginPage,
1012
loader: async ({ context }) => {
11-
const user = await context.ensureUser()
13+
const user = await context.queryClient.ensureQueryData(
14+
convexQuery(api.auth.getCurrentUser, {})
15+
)
1216

1317
if (user) {
1418
throw redirect({ to: '/account' })

src/routes/api/auth/$.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { reactStartHandler } from "~/server/auth"
2-
1+
import { reactStartHandler } from "~/server/auth.server"
32

43
export const ServerRoute = createServerFileRoute().methods({
54
GET: ({ request }) => {

src/server/auth.ts renamed to src/server/auth.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { convexAdapter } from '@convex-dev/better-auth'
22
import { convex } from '@convex-dev/better-auth/plugins'
33
import { betterAuth } from 'better-auth'
44
import { reactStartHelpers } from '@convex-dev/better-auth/react-start'
5-
import { GenericCtx } from 'convex/_generated/server'
6-
import { betterAuthComponent } from 'convex/auth'
5+
import { GenericCtx } from '../../convex/_generated/server'
6+
import { betterAuthComponent } from '../../convex/auth'
77

88
// You'll want to replace this with an environment variable
99
const siteUrl = process.env.URL

src/server/sponsors.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export async function getSponsorsAndTiers() {
139139
}
140140

141141
async function getGithubSponsors() {
142-
let sponsors: Sponsor = []
142+
let sponsors: Sponsor[] = []
143143
try {
144144
const fetchPage = async (cursor = '') => {
145145
const res = await graphqlWithAuth(
@@ -228,6 +228,10 @@ async function getGithubSponsors() {
228228
console.error('Missing github credentials, returning mock data.')
229229
return []
230230
}
231+
if (err.status === 403) {
232+
console.error('GitHub rate limit exceeded, returning empty sponsors.')
233+
return []
234+
}
231235
throw err
232236
}
233237
}

0 commit comments

Comments
 (0)