fix: copy fails in http environment (#43)

* 🐛 fix: copy fails in http environment

* 🎨 optimize: web UI
This commit is contained in:
Buer
2024-01-19 18:48:01 +08:00
committed by GitHub
parent 45fd814d77
commit 0be687905f
17 changed files with 88 additions and 36 deletions

View File

@@ -69,6 +69,17 @@ export function showInfo(message) {
enqueueSnackbar(message, getSnackbarOptions('INFO'));
}
export function copy(text, name = '') {
try {
navigator.clipboard.writeText(text);
} catch (error) {
text = `复制${name}失败,请手动复制:<br /><br />${text}`;
enqueueSnackbar(<SnackbarHTMLContent htmlContent={text} />, getSnackbarOptions('COPY'));
return;
}
showSuccess(`复制${name}成功!`);
}
export async function getOAuthState() {
try {
const res = await API.get('/api/oauth/state');