mirror of
https://github.com/sahadev/vue-component-creater-ui.git
synced 2025-12-18 08:24:15 +08:00
精简
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
import Vue from 'vue';
|
||||
import { stringify } from 'query-string';
|
||||
|
||||
const API = 'https://text.cinwell.xyz';
|
||||
|
||||
export async function upload(text) {
|
||||
Vue.toasted.show('Saving...');
|
||||
|
||||
try {
|
||||
const result = await fetch(API, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
},
|
||||
body: stringify({
|
||||
text,
|
||||
hash: 1
|
||||
})
|
||||
});
|
||||
|
||||
Vue.toasted.clear();
|
||||
|
||||
return await result.text();
|
||||
} catch (e) {
|
||||
Vue.toasted.clear();
|
||||
Vue.toasted.show('Failed: ' + e.message, {
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function downloadURL(hash) {
|
||||
return `${API}/${hash}`;
|
||||
}
|
||||
Reference in New Issue
Block a user