All files / src/services/api/routers AccessRouter.tsx

100% Statements 4/4
100% Branches 3/3
100% Functions 2/2
100% Lines 4/4

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                            2209x     2209x 43x 43x      
import { AccessCatalogue } from "@/objects/Organisation";
import { Dictionary } from "@/types/ext";
import { AxiosRequestConfig } from "axios";
import { APIRouter } from "../ApiRouter";
 
/** The access vocabulary: areas, levels and presets, from svc-core's
 *  registry (`app/services/access.py`). */
export class AccessRouter extends APIRouter {
  constructor(
    host: string,
    token: string | null = null,
    default_config: AxiosRequestConfig | null = null,
    headers: Dictionary<string> = {},
  ) {
    super("access", host, token, default_config, headers);
  }
 
  catalogue = async (): Promise<AccessCatalogue> => {
    const res = await this.api.get(this.endpoint("catalogue"));
    return res.data as AccessCatalogue;
  };
}