Remove redundant console logs and comments across components
- Cleaned up unused debug logs and comments in `AddNewBookForm`, `QuillConversation`, `OfflinePinSetup`, `OfflinePinVerify`, `ShortStoryGenerator`, and `page.tsx`. - Improved overall code readability and maintainability.
This commit is contained in:
@@ -269,15 +269,6 @@ function ScribeContent() {
|
|||||||
setLocalOnlyBooks(localSyncedBooks.filter((localBook: SyncedBook):boolean => !serverSyncedBooks.find((serverBook: SyncedBook):boolean => serverBook.id === localBook.id)))
|
setLocalOnlyBooks(localSyncedBooks.filter((localBook: SyncedBook):boolean => !serverSyncedBooks.find((serverBook: SyncedBook):boolean => serverBook.id === localBook.id)))
|
||||||
}, [localSyncedBooks, serverSyncedBooks]);
|
}, [localSyncedBooks, serverSyncedBooks]);
|
||||||
|
|
||||||
useEffect((): void => {
|
|
||||||
console.log('localSyncedBooks', localSyncedBooks);
|
|
||||||
console.log('serverSyncedBooks', serverSyncedBooks);
|
|
||||||
console.log('localOnlyBooks', localOnlyBooks);
|
|
||||||
console.log('serverOnlyBooks', serverOnlyBooks);
|
|
||||||
console.log('bookSyncDiffsFromServer', bookSyncDiffsFromServer);
|
|
||||||
console.log('bookSyncDiffsToServer', bookSyncDiffsToServer);
|
|
||||||
}, [localSyncedBooks, serverSyncedBooks,localOnlyBooks, bookSyncDiffsFromServer, bookSyncDiffsToServer]);
|
|
||||||
|
|
||||||
|
|
||||||
async function getBooks(): Promise<void> {
|
async function getBooks(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -223,9 +223,7 @@ export default function ShortStoryGenerator({onClose}: ShortStoryGeneratorProps)
|
|||||||
setGeneratedStoryTitle(data.title);
|
setGeneratedStoryTitle(data.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Le message final du endpoint avec title, totalPrice, useYourKey, totalCost
|
|
||||||
if (data.useYourKey !== undefined && data.totalPrice !== undefined) {
|
if (data.useYourKey !== undefined && data.totalPrice !== undefined) {
|
||||||
console.log(data);
|
|
||||||
if (data.useYourKey) {
|
if (data.useYourKey) {
|
||||||
setTotalPrice((prev: number): number => prev + data.totalPrice!);
|
setTotalPrice((prev: number): number => prev + data.totalPrice!);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ export default function AddNewBookForm({setCloseForm}: { setCloseForm: Dispatch<
|
|||||||
if (isCurrentlyOffline()) {
|
if (isCurrentlyOffline()) {
|
||||||
bookId = await window.electron.invoke<string>('db:book:create', bookData);
|
bookId = await window.electron.invoke<string>('db:book:create', bookData);
|
||||||
} else {
|
} else {
|
||||||
// Online - call API server
|
|
||||||
bookId = await System.authPostToServer<string>('book/add', bookData, token, lang);
|
bookId = await System.authPostToServer<string>('book/add', bookData, token, lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +153,6 @@ export default function AddNewBookForm({setCloseForm}: { setCloseForm: Dispatch<
|
|||||||
bookId: bookId,
|
bookId: bookId,
|
||||||
...bookData
|
...bookData
|
||||||
};
|
};
|
||||||
console.log(isCurrentlyOffline())
|
|
||||||
if (isCurrentlyOffline()){
|
if (isCurrentlyOffline()){
|
||||||
setLocalOnlyBooks((prevBooks: SyncedBook[]): SyncedBook[] => [...prevBooks, {
|
setLocalOnlyBooks((prevBooks: SyncedBook[]): SyncedBook[] => [...prevBooks, {
|
||||||
id: book.bookId,
|
id: book.bookId,
|
||||||
|
|||||||
@@ -54,14 +54,10 @@ export default function OfflinePinSetup({ onClose, onSuccess, showOnFirstLogin }
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (window.electron) {
|
if (window.electron) {
|
||||||
// Set the PIN
|
|
||||||
const result = await window.electron.offlinePinSet(pin);
|
const result = await window.electron.offlinePinSet(pin);
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
// Enable offline mode
|
|
||||||
await window.electron.offlineModeSet(true, 30); // 30 days sync interval
|
await window.electron.offlineModeSet(true, 30); // 30 days sync interval
|
||||||
|
|
||||||
console.log('[OfflinePin] PIN configured successfully');
|
|
||||||
onSuccess?.();
|
onSuccess?.();
|
||||||
} else {
|
} else {
|
||||||
setError(result.error || t('offline.pin.errors.setupFailed'));
|
setError(result.error || t('offline.pin.errors.setupFailed'));
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ export default function OfflinePinVerify({ onSuccess, onCancel }: OfflinePinVeri
|
|||||||
const result = await window.electron.offlinePinVerify(pin);
|
const result = await window.electron.offlinePinVerify(pin);
|
||||||
|
|
||||||
if (result.success && result.userId) {
|
if (result.success && result.userId) {
|
||||||
console.log('[OfflinePin] PIN verified, accessing offline mode');
|
|
||||||
onSuccess(result.userId);
|
onSuccess(result.userId);
|
||||||
} else {
|
} else {
|
||||||
setAttempts(prev => prev + 1);
|
setAttempts(prev => prev + 1);
|
||||||
@@ -47,7 +46,6 @@ export default function OfflinePinVerify({ onSuccess, onCancel }: OfflinePinVeri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[OfflinePin] Error verifying PIN:', error);
|
|
||||||
setError(t('offline.pin.verify.error'));
|
setError(t('offline.pin.verify.error'));
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|||||||
@@ -239,8 +239,6 @@ export default function QuillConversation(
|
|||||||
contextType: contextType,
|
contextType: contextType,
|
||||||
version: chapter?.chapterContent.version || null,
|
version: chapter?.chapterContent.version || null,
|
||||||
}, session.accessToken, lang);
|
}, session.accessToken, lang);
|
||||||
console.log(response);
|
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
if (response) {
|
if (response) {
|
||||||
setMessages((prevMessages: Message[]): Message[] => {
|
setMessages((prevMessages: Message[]): Message[] => {
|
||||||
|
|||||||
Reference in New Issue
Block a user