Convert JS to TS

This commit is contained in:
seunghyunOh
2022-12-06 05:53:34 +09:00
parent 3e2ed62e50
commit a47decd31f
13 changed files with 304 additions and 222 deletions
@@ -1,3 +1,5 @@
import { Workspaces } from "types/workspaces";
import SecurityClient from "~/utilities/SecurityClient";
/**
@@ -12,10 +14,11 @@ const getWorkspaces = () => {
},
}).then(async (res) => {
if (res?.status == 200) {
return (await res.json()).workspaces;
} else {
console.log("Failed to get projects");
const data = (await res.json()) as unknown as { workspaces: Workspaces };
return data.workspaces;
}
throw new Error("Failed to get projects");
});
};