Skip to content

Commit b5a4e42

Browse files
authored
Merge pull request #98 from reginaldbondoc/main
Fix workspace type definition
2 parents 112fc77 + 1212b5a commit b5a4e42

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

frontend/components/basic/Layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function Layout({ children }: LayoutProps) {
6767

6868
try {
6969
const workspaces = await getWorkspaces();
70-
const currentWorkspaces = (workspaces as unknown as any[]).map((workspace: any) => workspace.name);
70+
const currentWorkspaces = workspaces.map((workspace) => workspace.name);
7171
if (!currentWorkspaces.includes(workspaceName)) {
7272
const newWorkspace = await createWorkspace({
7373
workspaceName,

frontend/pages/api/workspace/getWorkspaces.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import SecurityClient from "~/utilities/SecurityClient";
22

3-
interface Workspaces {
3+
interface Workspace {
44
__v: number;
55
_id: string;
66
name: string;
77
organization: string;
88
}
9-
[];
109

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

0 commit comments

Comments
 (0)