mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 13:27:22 +00:00
Merge pull request #98 from reginaldbondoc/main
Fix workspace type definition
This commit is contained in:
@@ -67,7 +67,7 @@ export default function Layout({ children }: LayoutProps) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const workspaces = await getWorkspaces();
|
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)) {
|
if (!currentWorkspaces.includes(workspaceName)) {
|
||||||
const newWorkspace = await createWorkspace({
|
const newWorkspace = await createWorkspace({
|
||||||
workspaceName,
|
workspaceName,
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import SecurityClient from "~/utilities/SecurityClient";
|
import SecurityClient from "~/utilities/SecurityClient";
|
||||||
|
|
||||||
interface Workspaces {
|
interface Workspace {
|
||||||
__v: number;
|
__v: number;
|
||||||
_id: string;
|
_id: string;
|
||||||
name: string;
|
name: string;
|
||||||
organization: string;
|
organization: string;
|
||||||
}
|
}
|
||||||
[];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This route lets us get the workspaces of a certain user
|
* This route lets us get the workspaces of a certain user
|
||||||
@@ -20,7 +19,7 @@ const getWorkspaces = () => {
|
|||||||
},
|
},
|
||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
if (res?.status == 200) {
|
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;
|
return data.workspaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user