mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-09-12 19:58:21 +02:00
Fix any type usage in the saas/ folder (#5934)
# Description of Changes Ages ago I made #4835 to try and fix all the `any` type usage in the system but never got it finished, and there were just too many to review and ensure it still worked. There's even more now. My new tactic is to fix folder by folder. This fixes the `any` typing in the `saas/` folder, and also enables `no-unnecessary-type-assertion`, which really helps reduce pointless `as` casts that AI generates when the type is already known. I hope to expand both of these to the rest of the folders soon, but one folder is better than none.
This commit is contained in:
@@ -7,7 +7,7 @@ import { withBasePath } from '@app/constants/app'
|
||||
interface CallbackState {
|
||||
status: 'processing' | 'success' | 'error'
|
||||
message: string
|
||||
details?: Record<string, any>
|
||||
details?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export default function AuthCallback() {
|
||||
|
||||
@@ -68,7 +68,7 @@ export default function Login() {
|
||||
const redirectTo = absoluteWithBasePath('/auth/callback')
|
||||
console.log(`[Login] Signing in with ${provider}`)
|
||||
|
||||
const oauthOptions: any = { redirectTo }
|
||||
const oauthOptions: { redirectTo: string; queryParams?: Record<string, string> } = { redirectTo }
|
||||
if (provider === 'apple') {
|
||||
oauthOptions.queryParams = { scope: 'email name' }
|
||||
} else if (provider === 'azure') {
|
||||
@@ -175,12 +175,9 @@ export default function Login() {
|
||||
setError(null)
|
||||
console.log('[Login] Signing in anonymously')
|
||||
|
||||
const { data, error } = await signInAnonymously()
|
||||
const { data } = await signInAnonymously()
|
||||
|
||||
if (error) {
|
||||
console.error('[Login] Anonymous sign in error:', error)
|
||||
setError((error as any)?.message || 'Unknown error')
|
||||
} else if (data.user) {
|
||||
if (data.user) {
|
||||
console.log('[Login] Anonymous sign in successful, refreshing session...')
|
||||
|
||||
// Refresh session to ensure backend endpoints are properly synchronized
|
||||
|
||||
@@ -62,12 +62,9 @@ export default function Signup() {
|
||||
setError(null)
|
||||
|
||||
console.log('[Signup] Initiating anonymous sign-in...')
|
||||
const { data, error } = await signInAnonymously()
|
||||
const { data } = await signInAnonymously()
|
||||
|
||||
if (error) {
|
||||
console.error('[Signup] Anonymous sign-in error:', error)
|
||||
setError(`Failed to create guest account: ${(error as any)?.message || 'Unknown error'}`)
|
||||
} else if (data.user) {
|
||||
if (data.user) {
|
||||
console.log('[Signup] Anonymous sign-in successful, refreshing session...')
|
||||
|
||||
// Refresh session to ensure backend endpoints are properly synchronized
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function OAuthButtons({ onProviderClick, isSubmitting, layout = '
|
||||
position="top"
|
||||
>
|
||||
<button
|
||||
onClick={() => onProviderClick(p.id as any)}
|
||||
onClick={() => onProviderClick(p.id as 'github' | 'google')}
|
||||
disabled={isSubmitting || p.isDisabled}
|
||||
className="oauth-button-icon"
|
||||
aria-label={`${t('login.signInWith', 'Sign in with')} ${p.label}`}
|
||||
@@ -55,7 +55,7 @@ export default function OAuthButtons({ onProviderClick, isSubmitting, layout = '
|
||||
position="top"
|
||||
>
|
||||
<button
|
||||
onClick={() => onProviderClick(p.id as any)}
|
||||
onClick={() => onProviderClick(p.id as 'github' | 'google')}
|
||||
disabled={isSubmitting || p.isDisabled}
|
||||
className="oauth-button-grid"
|
||||
aria-label={`${t('login.signInWith', 'Sign in with')} ${p.label}`}
|
||||
@@ -74,7 +74,7 @@ export default function OAuthButtons({ onProviderClick, isSubmitting, layout = '
|
||||
{oauthProviders.map((p) => (
|
||||
<button
|
||||
key={p.id}
|
||||
onClick={() => onProviderClick(p.id as any)}
|
||||
onClick={() => onProviderClick(p.id as 'github' | 'google')}
|
||||
disabled={isSubmitting || p.isDisabled}
|
||||
className="oauth-button-fullwidth"
|
||||
title={p.label}
|
||||
@@ -92,7 +92,7 @@ export default function OAuthButtons({ onProviderClick, isSubmitting, layout = '
|
||||
{oauthProviders.map((p) => (
|
||||
<button
|
||||
key={p.id}
|
||||
onClick={() => onProviderClick(p.id as any)}
|
||||
onClick={() => onProviderClick(p.id as 'github' | 'google')}
|
||||
disabled={isSubmitting || p.isDisabled}
|
||||
className="oauth-button-vertical"
|
||||
title={p.label}
|
||||
|
||||
Reference in New Issue
Block a user