本文整理汇总了TypeScript中mithril.buildQueryString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript buildQueryString函数的具体用法?TypeScript buildQueryString怎么用?TypeScript buildQueryString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buildQueryString函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: apiCurrentAccessTokensPath
static apiCurrentAccessTokensPath(filter?: "all" | "revoked" | "active") {
if (filter) {
return `/go/api/current_user/access_tokens?${m.buildQueryString({filter})}`;
} else {
return `/go/api/current_user/access_tokens`;
}
}
示例2: pipelineMaterialSearchPath
static pipelineMaterialSearchPath(pipelineName: string, fingerprint: string, searchText: string): string {
const queryString = m.buildQueryString({
fingerprint,
pipeline_name: pipelineName,
search_text: searchText
});
return `/go/api/internal/material_search?${queryString}`;
}
示例3: queryConfig
export function queryConfig(pattern = "%"): Promise<any[]> {
const filter = stringify(["LIKE", ["PARAM", "_id"], pattern]);
return m.request({
method: "GET",
url: `api/config/?${m.buildQueryString({ filter: filter })}`,
background: true
});
}
示例4: resourceExists
export function resourceExists(resource, id): Promise<number> {
const param = resource === "devices" ? "DeviceID.ID" : "_id";
const filter = ["=", ["PARAM", param], id];
return m.request({
method: "HEAD",
url:
`/api/${resource}/?` +
m.buildQueryString({
filter: memoizedStringify(filter)
}),
extract: xhr => +xhr.getResponseHeader("x-total-count"),
background: true
});
}
示例5: Promise
new Promise((resolve2, reject2) => {
m.request({
method: "GET",
url:
`/api/${resourceType}/?` +
m.buildQueryString({
filter: memoizedStringify(combinedFilterDiff)
})
})
.then(res => {
for (const r of res as {}[]) {
const id =
resourceType === "devices"
? r["DeviceID.ID"].value[0]
: r["_id"];
resources[resourceType].objects.set(id, r);
deleted.delete(id);
}
for (const d of deleted) {
const obj = resources[resourceType].objects.get(d);
if (evaluate(combinedFilterDiff, obj, fulfillTimestamp))
resources[resourceType].objects.delete(d);
}
for (const queryResponse of toFetch) {
let filter = queries.filter.get(queryResponse);
filter = unpackExpression(filter);
const limit = queries.limit.get(queryResponse);
const bookmark = queries.bookmark.get(queryResponse);
const sort = queries.sort.get(queryResponse);
if (bookmark) filter = limitFilter(filter, sort, bookmark);
queries.value.set(
queryResponse,
findMatches(resourceType, filter, sort, limit)
);
queries.fulfilled.set(queryResponse, fulfillTimestamp);
queries.fulfilling.delete(queryResponse);
}
resolve2();
})
.catch(reject2);
})
示例6: m
view: () => {
if (window.username) {
return m(
"div.user-menu",
window.username,
m(
"button",
{
onclick: e => {
e.target.disabled = true;
store
.logOut()
.then(() => {
location.hash = "";
location.reload();
})
.catch(err => {
e.target.disabled = false;
notifications.push("error", err.message);
});
return false;
}
},
"Log out"
)
);
} else {
return m(
"div.user-menu",
m(
"a",
{
href:
"#!/login?" + m.buildQueryString({ continue: m.route.get() })
},
"Log in"
)
);
}
}
示例7: showDashboardPath
static showDashboardPath(viewName?: string): string {
if (viewName) {
return `/go/api/dashboard?${m.buildQueryString({viewName})}`;
}
return "/go/api/dashboard";
}
示例8: apiUsersSearchPath
static apiUsersSearchPath(searchText: string) {
return `/go/api/user_search?${m.buildQueryString({q: searchText})}`;
}