2019-06-19 14:40:52 +00:00
|
|
|
import { stringify as stringifyQs } from "qs";
|
2019-08-09 10:26:22 +00:00
|
|
|
import urlJoin from "url-join";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
2019-09-12 10:46:23 +00:00
|
|
|
import {
|
|
|
|
ActiveTab,
|
|
|
|
BulkAction,
|
|
|
|
Dialog,
|
|
|
|
Filters,
|
|
|
|
Pagination,
|
|
|
|
TabActionDialog
|
|
|
|
} from "../types";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
const staffSection = "/staff/";
|
|
|
|
|
|
|
|
export const staffListPath = staffSection;
|
2019-09-12 10:46:23 +00:00
|
|
|
export enum StaffListUrlFiltersEnum {
|
|
|
|
query = "query"
|
|
|
|
}
|
|
|
|
export type StaffListUrlFilters = Filters<StaffListUrlFiltersEnum>;
|
|
|
|
export type StaffListUrlDialog = "add" | "remove" | TabActionDialog;
|
|
|
|
export type StaffListUrlQueryParams = ActiveTab &
|
|
|
|
BulkAction &
|
2019-06-19 14:40:52 +00:00
|
|
|
Dialog<StaffListUrlDialog> &
|
2019-09-12 10:46:23 +00:00
|
|
|
Pagination &
|
|
|
|
StaffListUrlFilters;
|
2019-06-19 14:40:52 +00:00
|
|
|
export const staffListUrl = (params?: StaffListUrlQueryParams) =>
|
|
|
|
staffListPath + "?" + stringifyQs(params);
|
|
|
|
|
|
|
|
export const staffMemberDetailsPath = (id: string) => urlJoin(staffSection, id);
|
|
|
|
export type StaffMemberDetailsUrlDialog = "remove" | "remove-avatar";
|
|
|
|
export type StaffMemberDetailsUrlQueryParams = Dialog<
|
|
|
|
StaffMemberDetailsUrlDialog
|
|
|
|
>;
|
|
|
|
|
|
|
|
export const staffMemberDetailsUrl = (
|
|
|
|
id: string,
|
|
|
|
params?: StaffMemberDetailsUrlQueryParams
|
|
|
|
) => staffMemberDetailsPath(encodeURIComponent(id)) + "?" + stringifyQs(params);
|