Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 2209x 2209x 3x 3x 2209x 3x 3x | import { WorkspaceInfo } from "@/context/WorkspaceContext";
import { Dictionary } from "@/types/ext";
import { AxiosRequestConfig } from "axios";
import { APIRouter } from "../ApiRouter";
/** The workspaces a user can open (svc-core `app/services/workspace.py`):
* what the switcher lists, and how a URL's workspace resolves. */
export class WorkspaceRouter extends APIRouter {
constructor(
host: string,
token: string | null = null,
default_config: AxiosRequestConfig | null = null,
headers: Dictionary<string> = {},
) {
super("workspaces", host, token, default_config, headers);
}
list = async (): Promise<WorkspaceInfo[]> => {
const res = await this.api.get(this.prefix);
return res.data as WorkspaceInfo[];
};
resolve = async (key: string): Promise<WorkspaceInfo> => {
const res = await this.api.get(this.endpoint("resolve"), { params: { key } });
return res.data as WorkspaceInfo;
};
}
|