Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/common/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,12 @@ export async function deleteWorkspaceFile(workspaceId: string, fileId: string):

/** Start Google Drive OAuth — returns redirect URL. */
export async function startDriveOAuth(): Promise<string> {
try {
const payload = await apiFetch<{ url?: string }>("/api/v1/oauth/drive/start", { method: "POST" });
if (payload?.url) return payload.url;
} catch (err) {
if (isMissingEndpoint(err)) {
return "#drive-oauth-stub";
}
throw err;
const payload = await apiFetch<{ url?: string; state?: string }>("/api/v1/me/drive/oauth/start", {
method: "POST",
});
const url = payload?.url?.trim();
if (!url) {
throw new Error("Drive OAuth start did not return a URL");
}
return "#drive-oauth-stub";
return url;
}
9 changes: 2 additions & 7 deletions src/components/Portal/TaskWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
* @module TaskWorkspace
*/

import { ErrorToast, SuccessToast, WarningToast } from "@svonk/util";
import { ErrorToast, SuccessToast } from "@svonk/util";
import OverlayWrapper from "@/components/Modal/OverlayWrapper.vue";
import Modal from "@/components/Modal/Modal.vue";
import {
Expand Down Expand Up @@ -352,12 +352,7 @@ export default {
async connectDrive() {
try {
const url = await startDriveOAuth();
if (url && url !== "#drive-oauth-stub") {
window.open(url, "_blank", "noopener");
} else {
new WarningToast("Drive connect will be available when the server route is live", 2500);
this.driveConnected = true;
}
window.open(url, "_blank", "noopener");
} catch (err) {
new ErrorToast("Couldn't start Drive connect", err, 2000);
}
Expand Down
Loading