rm log
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
import { logger } from '../utils/logger.js'
|
||||||
|
|
||||||
export default function AuthButton({ user, onLogin, onLogout, loading }) {
|
export default function AuthButton({ user, onLogin, onLogout, loading }) {
|
||||||
const [handleInput, setHandleInput] = useState('')
|
const [handleInput, setHandleInput] = useState('')
|
||||||
@@ -12,7 +13,7 @@ export default function AuthButton({ user, onLogin, onLogout, loading }) {
|
|||||||
try {
|
try {
|
||||||
await onLogin(handleInput.trim())
|
await onLogin(handleInput.trim())
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Login failed:', error)
|
logger.error('Login failed:', error)
|
||||||
alert('ログインに失敗しました: ' + error.message)
|
alert('ログインに失敗しました: ' + error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import Avatar, { AvatarWithCard, AvatarList } from './Avatar.jsx'
|
import Avatar, { AvatarWithCard, AvatarList } from './Avatar.jsx'
|
||||||
import { getAvatar, batchFetchAvatars, prefetchAvatar } from '../utils/avatar.js'
|
import { getAvatar, batchFetchAvatars, prefetchAvatar } from '../utils/avatar.js'
|
||||||
|
import { logger } from '../utils/logger.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test component to demonstrate avatar functionality
|
* Test component to demonstrate avatar functionality
|
||||||
@@ -63,7 +64,7 @@ export default function AvatarTest() {
|
|||||||
|
|
||||||
setTestResults(results)
|
setTestResults(results)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Test failed:', error)
|
logger.error('Test failed:', error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,7 @@ export default function AvatarTest() {
|
|||||||
batchResults: Object.fromEntries(avatarMap)
|
batchResults: Object.fromEntries(avatarMap)
|
||||||
}))
|
}))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Batch test failed:', error)
|
logger.error('Batch test failed:', error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -94,7 +95,7 @@ export default function AvatarTest() {
|
|||||||
prefetchResult: cachedAvatar
|
prefetchResult: cachedAvatar
|
||||||
}))
|
}))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Prefetch test failed:', error)
|
logger.error('Prefetch test failed:', error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { atproto, collections } from '../api/atproto.js'
|
import { atproto, collections } from '../api/atproto.js'
|
||||||
import { env } from '../config/env.js'
|
import { env } from '../config/env.js'
|
||||||
|
import { logger } from '../utils/logger.js'
|
||||||
|
|
||||||
const ProfileForm = ({ user, agent, apiConfig, onProfilePosted }) => {
|
const ProfileForm = ({ user, agent, apiConfig, onProfilePosted }) => {
|
||||||
const [text, setText] = useState('')
|
const [text, setText] = useState('')
|
||||||
@@ -79,7 +80,7 @@ const ProfileForm = ({ user, agent, apiConfig, onProfilePosted }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to create profile:', err)
|
logger.error('Failed to create profile:', err)
|
||||||
setError(err.message || 'プロフィールの作成に失敗しました')
|
setError(err.message || 'プロフィールの作成に失敗しました')
|
||||||
} finally {
|
} finally {
|
||||||
setPosting(false)
|
setPosting(false)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { atproto } from '../api/atproto.js'
|
import { atproto } from '../api/atproto.js'
|
||||||
import { getPdsFromHandle, getApiConfig } from '../utils/pds.js'
|
import { getPdsFromHandle, getApiConfig } from '../utils/pds.js'
|
||||||
|
import { logger } from '../utils/logger.js'
|
||||||
|
|
||||||
export default function UserLookup() {
|
export default function UserLookup() {
|
||||||
const [handleInput, setHandleInput] = useState('')
|
const [handleInput, setHandleInput] = useState('')
|
||||||
@@ -26,7 +27,7 @@ export default function UserLookup() {
|
|||||||
config: apiConfig
|
config: apiConfig
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('User lookup failed:', error)
|
logger.error('User lookup failed:', error)
|
||||||
setUserInfo({ error: error.message })
|
setUserInfo({ error: error.message })
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { OAuthService } from '../services/oauth.js'
|
import { OAuthService } from '../services/oauth.js'
|
||||||
|
import { logger } from '../utils/logger.js'
|
||||||
|
|
||||||
const oauthService = new OAuthService()
|
const oauthService = new OAuthService()
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ export function useAuth() {
|
|||||||
|
|
||||||
// If we're on callback page and authentication succeeded, notify parent
|
// If we're on callback page and authentication succeeded, notify parent
|
||||||
if (window.location.pathname === '/oauth/callback') {
|
if (window.location.pathname === '/oauth/callback') {
|
||||||
console.log('OAuth callback completed, notifying parent window')
|
logger.log('OAuth callback completed, notifying parent window')
|
||||||
|
|
||||||
// Get referrer or use stored return URL
|
// Get referrer or use stored return URL
|
||||||
const returnUrl = sessionStorage.getItem('oauth_return_url') ||
|
const returnUrl = sessionStorage.getItem('oauth_return_url') ||
|
||||||
@@ -48,7 +49,7 @@ export function useAuth() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Auth initialization failed:', error)
|
logger.error('Auth initialization failed:', error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ import { BrowserOAuthClient } from '@atproto/oauth-client-browser'
|
|||||||
import { Agent } from '@atproto/api'
|
import { Agent } from '@atproto/api'
|
||||||
import { env } from '../config/env.js'
|
import { env } from '../config/env.js'
|
||||||
import { isSyuIsHandle } from '../utils/pds.js'
|
import { isSyuIsHandle } from '../utils/pds.js'
|
||||||
|
import { logger } from '../utils/logger.js'
|
||||||
|
|
||||||
export class OAuthService {
|
export class OAuthService {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -44,7 +45,7 @@ export class OAuthService {
|
|||||||
// Try to restore session
|
// Try to restore session
|
||||||
return await this.restoreSession()
|
return await this.restoreSession()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('OAuth initialization failed:', error)
|
logger.error('OAuth initialization failed:', error)
|
||||||
this.initPromise = null
|
this.initPromise = null
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
@@ -89,18 +90,18 @@ export class OAuthService {
|
|||||||
displayName = profile.data.displayName || null
|
displayName = profile.data.displayName || null
|
||||||
avatar = profile.data.avatar || null
|
avatar = profile.data.avatar || null
|
||||||
|
|
||||||
console.log('Profile fetched from session:', {
|
logger.log('Profile fetched from session:', {
|
||||||
did,
|
did,
|
||||||
handle,
|
handle,
|
||||||
displayName,
|
displayName,
|
||||||
avatar: avatar ? 'present' : 'none'
|
avatar: avatar ? 'present' : 'none'
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('Failed to get profile from session:', error)
|
logger.log('Failed to get profile from session:', error)
|
||||||
// Keep the basic info we have
|
// Keep the basic info we have
|
||||||
}
|
}
|
||||||
} else if (did && did.includes('test-')) {
|
} else if (did && did.includes('test-')) {
|
||||||
console.log('Skipping profile fetch for test DID:', did)
|
logger.log('Skipping profile fetch for test DID:', did)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sessionInfo = {
|
this.sessionInfo = {
|
||||||
@@ -140,7 +141,7 @@ export class OAuthService {
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Auth check failed:', error)
|
logger.error('Auth check failed:', error)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +169,7 @@ export class OAuthService {
|
|||||||
// Reload page
|
// Reload page
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Logout failed:', error)
|
logger.error('Logout failed:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user