mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Refactor API routes to use UUIDs instead of friendly names (#401)
* Add client for agent * Cleanup code * Fix linting error * Rename routes to be simpler * Rename workspace history to workspace build * Refactor HTTP middlewares to use UUIDs * Cleanup routes * Compiles! * Fix files and organizations * Fix querying * Fix agent lock * Cleanup database abstraction * Add parameters * Fix linting errors * Fix log race * Lock on close wait * Fix log cleanup * Fix e2e tests * Fix upstream version of opencensus-go * Update coderdtest.go * Fix coverpkg * Fix codecov ignore
This commit is contained in:
+2
-2
@@ -108,7 +108,7 @@ export namespace Workspace {
|
||||
}
|
||||
|
||||
export const login = async (email: string, password: string): Promise<LoginResponse> => {
|
||||
const response = await fetch("/api/v2/login", {
|
||||
const response = await fetch("/api/v2/users/login", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -128,7 +128,7 @@ export const login = async (email: string, password: string): Promise<LoginRespo
|
||||
}
|
||||
|
||||
export const logout = async (): Promise<void> => {
|
||||
const response = await fetch("/api/v2/logout", {
|
||||
const response = await fetch("/api/v2/users/logout", {
|
||||
method: "POST",
|
||||
})
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const globalSetup = async (config: FullConfig): Promise<void> => {
|
||||
})
|
||||
|
||||
// Create initial user
|
||||
await context.post("/api/v2/user", {
|
||||
await context.post("/api/v2/users/first", {
|
||||
data: {
|
||||
email,
|
||||
username,
|
||||
|
||||
@@ -18,8 +18,10 @@ import { CodeExample } from "../../components/CodeExample/CodeExample"
|
||||
const ProjectsPage: React.FC = () => {
|
||||
const styles = useStyles()
|
||||
const { me, signOut } = useUser(true)
|
||||
const { data: projects, error } = useSWR<Project[] | null, Error>("/api/v2/projects")
|
||||
const { data: orgs, error: orgsError } = useSWR<Organization[], Error>("/api/v2/users/me/organizations")
|
||||
const { data: projects, error } = useSWR<Project[] | null, Error>(
|
||||
orgs ? `/api/v2/organizations/${orgs[0].id}/projects` : null,
|
||||
)
|
||||
|
||||
if (error) {
|
||||
return <ErrorSummary error={error} />
|
||||
|
||||
Reference in New Issue
Block a user