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

81.81% Statements 9/11
71.42% Branches 5/7
100% Functions 3/3
81.81% Lines 9/11

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 29 30 31                      2209x     2209x 3x 3x 3x         2209x 3x 3x 3x          
import { APIRouter } from "../ApiRouter";
import { Dictionary } from "@/types/ext";
import { AxiosRequestConfig } from "axios";
import { Industry } from "@/objects/Industry";
export class IndustryRouter extends APIRouter {
  constructor(
    host: string,
    token: string | null = null,
    default_config: AxiosRequestConfig | null = null,
    headers: Dictionary<string> = {}
  ) {
    super("resources/industries", host, token, default_config, headers);
  }
 
  list = async () => {
    const res = await this.api.get(super.endpoint("list"));
    Eif (super.validRes(res)) {
      return res.data as Industry[];
    }
    return null;
  };
 
  id = async (val: string) => {
    const res = await this.api.get(super.endpoint(`id/${val}`));
    Eif (super.validRes(res)) {
      return res.data as Industry;
    }
    return null;
  };
}