mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Mock out api call on frontend
This commit is contained in:
@@ -286,6 +286,23 @@ export const getWorkspaces = async (
|
||||
return response.data
|
||||
}
|
||||
|
||||
// TODO change types
|
||||
export const getWorkspacesCount = async (
|
||||
options: TypesGen.AuditLogCountRequest = {}
|
||||
): Promise<TypesGen.AuditLogCountResponse> => {
|
||||
const searchParams = new URLSearchParams()
|
||||
if (options.q) {
|
||||
searchParams.set("q", options.q)
|
||||
}
|
||||
// TODO
|
||||
// const response = await axios.get(
|
||||
// `/api/v2/workspaces/count?${searchParams.toString()}`,
|
||||
// )
|
||||
// return response.data
|
||||
|
||||
return Promise.resolve({ count: 10 })
|
||||
}
|
||||
|
||||
export const getWorkspaceByOwnerAndName = async (
|
||||
username = "me",
|
||||
workspaceName: string,
|
||||
|
||||
@@ -387,7 +387,6 @@ createMachine(
|
||||
},
|
||||
assignUpdatedWorkspaceRefs: assign({
|
||||
workspaceRefs: (_, event) => {
|
||||
|
||||
const newWorkspaceRefs = event.data.newWorkspaces.map((workspace) =>
|
||||
spawn(
|
||||
workspaceItemMachine.withContext({ data: workspace }),
|
||||
@@ -440,10 +439,9 @@ createMachine(
|
||||
newWorkspaces,
|
||||
})
|
||||
},
|
||||
getWorkspacesCount: () => {
|
||||
//API.getWorkspacesCount()
|
||||
return Promise.resolve({ count: 10 })
|
||||
}
|
||||
getWorkspacesCount: (context) => (
|
||||
API.getWorkspacesCount({ q: context.filter })
|
||||
)
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user