chore: get shortcut by name and workspace name

This commit is contained in:
Steven
2022-09-14 22:49:45 +08:00
parent ee801af742
commit 5a79304153
9 changed files with 170 additions and 39 deletions

View File

@@ -87,6 +87,10 @@ export function getShortcutList(shortcutFind?: ShortcutFind) {
return axios.get<ResponseObject<Shortcut[]>>(`/api/shortcut?${queryList.join("&")}`);
}
export function getShortcutWithNameAndWorkspaceName(workspaceName: string, shortcutName: string) {
return axios.get<ResponseObject<Shortcut>>(`/api/workspace/${workspaceName}/shortcut/${shortcutName}`);
}
export function createShortcut(shortcutCreate: ShortcutCreate) {
return axios.post<ResponseObject<Shortcut>>("/api/shortcut", shortcutCreate);
}

View File

@@ -44,15 +44,3 @@ export function throttle(fn: FunctionType, delay: number) {
}, delay);
};
}
export async function copyTextToClipboard(text: string) {
if (navigator.clipboard && navigator.clipboard.writeText) {
try {
await navigator.clipboard.writeText(text);
} catch (error: unknown) {
console.warn("Copy to clipboard failed.", error);
}
} else {
console.warn("Copy to clipboard failed, methods not supports.");
}
}