diff options
author | Skitty1238 <157652284+Skitty1238@users.noreply.github.com> | 2025-06-04 13:59:34 -0400 |
---|---|---|
committer | Skitty1238 <157652284+Skitty1238@users.noreply.github.com> | 2025-06-04 13:59:34 -0400 |
commit | 645df1d00f953524c6da22103d26c38ae4331cd6 (patch) | |
tree | 85fc3d4d3f0df579b5c53387d579e46b24e5c543 /src/client/views/nodes/TaskBox.tsx | |
parent | 5a998955235d141d2488c1c2deef50a3d6cf65c7 (diff) |
partial google calendar task integration + fix with dark mode colors for task nodes so that text is still visible
Diffstat (limited to 'src/client/views/nodes/TaskBox.tsx')
-rw-r--r-- | src/client/views/nodes/TaskBox.tsx | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/src/client/views/nodes/TaskBox.tsx b/src/client/views/nodes/TaskBox.tsx index 1c7aeeb82..3990356b9 100644 --- a/src/client/views/nodes/TaskBox.tsx +++ b/src/client/views/nodes/TaskBox.tsx @@ -270,43 +270,38 @@ export class TaskBox extends React.Component<TaskBoxProps> { )} {/** test button */} - <button - className="task-manager-google" - onClick={async () => { - console.log('GT button clicked'); - const token = await GoogleAuthenticationManager.Instance.fetchOrGenerateAccessToken(); - console.log('Got token', token); - - try { - const response = await fetch('/googleTasks/create', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${token}`, - }, - body: JSON.stringify({ - title: taskTitle || 'Untitled Task', - notes: taskDesc, - due: allDay - ? String(doc.$task_dateRange)?.split('|')[0] + 'T23:59:00Z' - : (doc.$task_endTime instanceof DateField && doc.$task_endTime.date?.toISOString()) || undefined, - }), - }); - - const result = await response.json(); - console.log("📬 Google Task result:", result); - alert(result?.id ? 'Task sent to Google Tasks!' : `Failed: ${result?.error?.message || 'Unknown error'}`); - } catch (err) { - console.error("Fetch error:", err); - alert("Fetch failed: "); - } - }} - > - GT - </button> - - - + <button + className="task-manager-google" + onClick={async () => { + console.log('GT button clicked'); + const token = await GoogleAuthenticationManager.Instance.fetchOrGenerateAccessToken(); + console.log('Got token', token); + + try { + const response = await fetch('/googleTasks/create', { + method: 'POST', + credentials: 'include', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + body: JSON.stringify({ + title: taskTitle || 'Untitled Task', + notes: taskDesc, + due: allDay ? String(doc.$task_dateRange)?.split('|')[0] + 'T23:59:00Z' : (doc.$task_endTime instanceof DateField && doc.$task_endTime.date?.toISOString()) || undefined, + }), + }); + + const result = await response.text(); + console.log('Google Task result:', result); + alert(result?.id ? 'Task sent to Google Tasks!' : `Failed: ${result?.error?.message || 'Unknown error'}`); + } catch (err) { + console.error('Fetch error:', err); + alert('Fetch failed: '); + } + }}> + GT + </button> </div> ); } |