Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workspace type definition #98

Merged
merged 2 commits into from
Dec 7, 2022
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
2 changes: 1 addition & 1 deletion frontend/components/basic/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function Layout({ children }: LayoutProps) {

try {
const workspaces = await getWorkspaces();
const currentWorkspaces = (workspaces as unknown as any[]).map((workspace: any) => workspace.name);
const currentWorkspaces = workspaces.map((workspace) => workspace.name);
if (!currentWorkspaces.includes(workspaceName)) {
const newWorkspace = await createWorkspace({
workspaceName,
Expand Down
5 changes: 2 additions & 3 deletions frontend/pages/api/workspace/getWorkspaces.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import SecurityClient from "~/utilities/SecurityClient";

interface Workspaces {
interface Workspace {
__v: number;
_id: string;
name: string;
organization: string;
}
[];

/**
* This route lets us get the workspaces of a certain user
Expand All @@ -20,7 +19,7 @@ const getWorkspaces = () => {
},
}).then(async (res) => {
if (res?.status == 200) {
const data = (await res.json()) as unknown as { workspaces: Workspaces };
const data = (await res.json()) as unknown as { workspaces: Workspace[] };
return data.workspaces;
}

Expand Down