Fix login issues
All checks were successful
Build Docker Images / build-and-push (push) Successful in 1m23s

This commit is contained in:
Michał Zieliński
2025-10-19 11:04:14 +02:00
parent e086a919c3
commit decc72c554
3 changed files with 8 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ async function handleAuthError(error, context = '') {
const errorMessage = error?.message || error?.type || error?.toString() || 'Unknown error'; const errorMessage = error?.message || error?.type || error?.toString() || 'Unknown error';
const fullError = `${context}: ${errorMessage}`; const fullError = `${context}: ${errorMessage}`;
console.error('Google Auth Error:', { context, error, fullError }); console.error('Google Auth Error:', { context, error, fullError });
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInError', fullError); await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInError', fullError);
} }
async function fetchUserInfo(accessToken) { async function fetchUserInfo(accessToken) {
@@ -39,7 +39,7 @@ async function fetchUserInfo(accessToken) {
if (!response.ok) { if (!response.ok) {
const errorText = await response.text(); const errorText = await response.text();
console.error('Failed to fetch user info:', errorText); console.error('Failed to fetch user info:', errorText);
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInError', await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInError',
`Failed to fetch user info: HTTP ${response.status}`); `Failed to fetch user info: HTTP ${response.status}`);
return null; return null;
} }
@@ -62,7 +62,7 @@ window.initGoogleSignIn = async function(clientId) {
try { try {
if (tokenResponse.error) { if (tokenResponse.error) {
console.error('Token response error:', tokenResponse.error); console.error('Token response error:', tokenResponse.error);
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInError', await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInError',
tokenResponse.error); tokenResponse.error);
return; return;
} }
@@ -70,7 +70,7 @@ window.initGoogleSignIn = async function(clientId) {
const userInfo = await fetchUserInfo(tokenResponse.access_token); const userInfo = await fetchUserInfo(tokenResponse.access_token);
if (!userInfo) return; if (!userInfo) return;
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInSuccess', await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInSuccess',
tokenResponse.access_token, tokenResponse.access_token,
userInfo.name || '', userInfo.name || '',
userInfo.email || '', userInfo.email || '',
@@ -78,7 +78,7 @@ window.initGoogleSignIn = async function(clientId) {
); );
} catch (error) { } catch (error) {
console.error('Callback error:', error); console.error('Callback error:', error);
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInError', await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInError',
error.message || 'Unknown callback error'); error.message || 'Unknown callback error');
} finally { } finally {
isSigningIn = false; isSigningIn = false;
@@ -86,7 +86,7 @@ window.initGoogleSignIn = async function(clientId) {
}, },
error_callback: async (error) => { error_callback: async (error) => {
console.error('OAuth flow error:', error); console.error('OAuth flow error:', error);
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInError', await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInError',
error.type || 'OAuth flow error'); error.type || 'OAuth flow error');
isSigningIn = false; isSigningIn = false;
} }
@@ -95,7 +95,7 @@ window.initGoogleSignIn = async function(clientId) {
return googleClient; return googleClient;
} catch (error) { } catch (error) {
console.error('Initiaxcrun xctrace list deviceslization error:', error); console.error('Initiaxcrun xctrace list deviceslization error:', error);
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInError', await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInError',
error.message || 'Failed to initialize Google Sign-In'); error.message || 'Failed to initialize Google Sign-In');
isSigningIn = false; isSigningIn = false;
} }
@@ -109,7 +109,7 @@ window.requestGoogleSignIn = async function() {
if (!googleClient) { if (!googleClient) {
console.error('Google Sign-In not initialized'); console.error('Google Sign-In not initialized');
await DotNet.invokeMethodAsync('Bimai.UI.Shared', 'OnGoogleSignInError', await DotNet.invokeMethodAsync('BimAI.UI.Shared', 'OnGoogleSignInError',
'Google Sign-In not initialized. Call initGoogleSignIn first.'); 'Google Sign-In not initialized. Call initGoogleSignIn first.');
return; return;
} }