mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-19 22:53:41 +08:00
fix: copy fails in http environment (#43)
* 🐛 fix: copy fails in http environment * 🎨 optimize: web UI
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user