Skip to content

Commit

Permalink
Merge pull request #98 from reginaldbondoc/main
Browse files Browse the repository at this point in the history
Fix workspace type definition
  • Loading branch information
vmatsiiako authored Dec 7, 2022
2 parents 112fc77 + 1212b5a commit b5a4e42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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

0 comments on commit b5a4e42

Please sign in to comment.