本文整理汇总了TypeScript中url-join.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript url-join.default方法的具体用法?TypeScript url-join.default怎么用?TypeScript url-join.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类url-join
的用法示例。
在下文中一共展示了url-join.default方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: urlJoin
export const addAttributePath = (
productTypeId: string,
type: AttributeTypeEnum
) =>
type === AttributeTypeEnum.PRODUCT
? urlJoin(productTypePath(productTypeId), "attribute/product/add")
: urlJoin(productTypePath(productTypeId), "attribute/variant/add");
示例2: webpack
export function webpack(assetName: string) {
if (ENV === 'production') {
const manifestPath = path.join(WEBPACK_OUTPUT_PATH, 'manifest.json')
const manifest = JSON.parse(fs.readFileSync(manifestPath).toString('utf8'))
return urljoin('/admin/build/', manifest[assetName])
} else {
if (assetName.match(/\.js$/)) {
assetName = `js/${assetName}`
} else if (assetName.match(/\.css$/)) {
assetName = `css/${assetName}`
}
return urljoin(WEBPACK_DEV_URL, assetName)
}
}
示例3: Error
export async function startReplyChainInChannel(chatConnector: builder.ChatConnector, message: builder.Message, channelId: string): Promise<builder.IChatConnectorAddress> {
let activity = message.toMessage();
// Build request
let options: request.Options = {
method: "POST",
// We use urlJoin to concatenate urls. url.resolve should not be used here,
// since it resolves urls as hrefs are resolved, which could result in losing
// the last fragment of the serviceUrl
url: urlJoin((activity.address as any).serviceUrl, "/v3/conversations"),
body: {
isGroup: true,
activity: activity,
channelData: {
teamsChannelId: channelId,
},
},
json: true,
};
let response = await sendRequestWithAccessToken(chatConnector, options);
if (response && response.hasOwnProperty("id")) {
let address = createAddressFromResponse(activity.address, response) as any;
if (address.user) {
delete address.user;
}
if (address.correlationId) {
delete address.correlationId;
}
return address;
} else {
throw new Error("Failed to start reply chain: no conversation ID returned.");
}
}
示例4: urlJoin
export const productListUrl = (params?: ProductListQueryParams): string => {
if (params === undefined) {
return productListPath;
} else {
return urlJoin(productListPath, "?" + stringifyQs(params));
}
};
示例5: urlJoin
export const orderListUrl = (params?: OrderListUrlQueryParams): string => {
const orderList = orderListPath;
if (params === undefined) {
return orderList;
} else {
return urlJoin(orderList, "?" + stringifyQs(params));
}
};
示例6: setupCommands
export function setupCommands(server: Server, commands: CommandDefinition[]) {
// Generate and register routes for commands
for (let command of commands) {
server.route({
method: command.method || "GET",
path: urljoin("/commands", command.path || slug(command.name)),
config: {
auth: command.auth
},
handler: buildCommandHandler({ command: command.command, options: command.options })
});
}
}
示例7: urlJoin
export const saleAssignProductsPath = (id: string) =>
urlJoin(salePath(id), "assign-products");
示例8: urlPathJoin
function urlPathJoin(...parts: string[]): string {
return urljoin(...parts);
}
示例9: stringifyQs
export const customerSection = "/customers/";
export const customerListPath = customerSection;
export type CustomerListUrlDialog = "remove";
export type CustomerListUrlQueryParams = BulkAction &
Dialog<CustomerListUrlDialog> &
Pagination;
export const customerListUrl = (params?: CustomerListUrlQueryParams) =>
customerListPath + "?" + stringifyQs(params);
export const customerPath = (id: string) => urlJoin(customerSection, id);
export type CustomerUrlDialog = "remove";
export type CustomerUrlQueryParams = Dialog<CustomerUrlDialog>;
export const customerUrl = (id: string, params?: CustomerUrlQueryParams) =>
customerPath(encodeURIComponent(id)) + "?" + stringifyQs(params);
export const customerAddPath = urlJoin(customerSection, "add");
export const customerAddUrl = customerAddPath;
export const customerAddressesPath = (id: string) =>
urlJoin(customerPath(id), "addresses");
export type CustomerAddressesUrlDialog = "add" | "edit" | "remove";
export type CustomerAddressesUrlQueryParams = Dialog<
CustomerAddressesUrlDialog
> &
SingleAction;
export const customerAddressesUrl = (
id: string,
params?: CustomerAddressesUrlQueryParams
) => customerAddressesPath(encodeURIComponent(id)) + "?" + stringifyQs(params);
示例10: urlEncodeParts
function urlEncodeParts(uri: string): string {
// Normalize and join, split, encode, then join.
uri = urljoin(uri);
let parts = uri.split('/').map(encodeURIComponent);
return urljoin(...parts);
}