2021-08-09 15:27:13 +00:00
|
|
|
import { stringifyQs } from "@saleor/utils/urls";
|
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,
|
2020-05-14 09:30:32 +00:00
|
|
|
Sort,
|
|
|
|
TabActionDialog
|
2019-09-12 10:46:23 +00:00
|
|
|
} 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 {
|
2020-01-07 12:06:11 +00:00
|
|
|
status = "status",
|
2019-09-12 10:46:23 +00:00
|
|
|
query = "query"
|
|
|
|
}
|
|
|
|
export type StaffListUrlFilters = Filters<StaffListUrlFiltersEnum>;
|
|
|
|
export type StaffListUrlDialog = "add" | "remove" | TabActionDialog;
|
2019-12-17 17:13:56 +00:00
|
|
|
export enum StaffListUrlSortField {
|
|
|
|
name = "name",
|
|
|
|
email = "email"
|
|
|
|
}
|
|
|
|
export type StaffListUrlSort = Sort<StaffListUrlSortField>;
|
2019-09-12 10:46:23 +00:00
|
|
|
export type StaffListUrlQueryParams = ActiveTab &
|
|
|
|
BulkAction &
|
2019-06-19 14:40:52 +00:00
|
|
|
Dialog<StaffListUrlDialog> &
|
2019-09-12 10:46:23 +00:00
|
|
|
Pagination &
|
2019-12-17 17:13:56 +00:00
|
|
|
StaffListUrlFilters &
|
|
|
|
StaffListUrlSort;
|
2019-06-19 14:40:52 +00:00
|
|
|
export const staffListUrl = (params?: StaffListUrlQueryParams) =>
|
|
|
|
staffListPath + "?" + stringifyQs(params);
|
|
|
|
|
|
|
|
export const staffMemberDetailsPath = (id: string) => urlJoin(staffSection, id);
|
2019-12-03 16:14:30 +00:00
|
|
|
export type StaffMemberDetailsUrlDialog =
|
|
|
|
| "change-password"
|
|
|
|
| "remove"
|
|
|
|
| "remove-avatar";
|
2019-06-19 14:40:52 +00:00
|
|
|
export type StaffMemberDetailsUrlQueryParams = Dialog<
|
|
|
|
StaffMemberDetailsUrlDialog
|
|
|
|
>;
|
|
|
|
|
|
|
|
export const staffMemberDetailsUrl = (
|
|
|
|
id: string,
|
|
|
|
params?: StaffMemberDetailsUrlQueryParams
|
|
|
|
) => staffMemberDetailsPath(encodeURIComponent(id)) + "?" + stringifyQs(params);
|