mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-03 23:14:13 +00:00 
			
		
		
		
	Better UX
This commit is contained in:
		
							parent
							
								
									a3c4e8a1bc
								
							
						
					
					
						commit
						a86ae9fa50
					
				
					 2 changed files with 11 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -148,7 +148,7 @@ export default Vue.extend({
 | 
			
		|||
		},
 | 
			
		||||
 | 
			
		||||
		updateStats() {
 | 
			
		||||
			this.$root.api('stats').then(stats => {
 | 
			
		||||
			this.$root.api('stats', {}, false, true).then(stats => {
 | 
			
		||||
				this.stats = stats;
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -385,15 +385,19 @@ export default class MiOS extends EventEmitter {
 | 
			
		|||
	 * @param data パラメータ
 | 
			
		||||
	 */
 | 
			
		||||
	@autobind
 | 
			
		||||
	public api(endpoint: string, data: { [x: string]: any } = {}, forceFetch = false): Promise<{ [x: string]: any }> {
 | 
			
		||||
		if (++pending === 1) {
 | 
			
		||||
			spinner = document.createElement('div');
 | 
			
		||||
			spinner.setAttribute('id', 'wait');
 | 
			
		||||
			document.body.appendChild(spinner);
 | 
			
		||||
	public api(endpoint: string, data: { [x: string]: any } = {}, forceFetch = false, silent = false): Promise<{ [x: string]: any }> {
 | 
			
		||||
		if (!silent) {
 | 
			
		||||
			if (++pending === 1) {
 | 
			
		||||
				spinner = document.createElement('div');
 | 
			
		||||
				spinner.setAttribute('id', 'wait');
 | 
			
		||||
				document.body.appendChild(spinner);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const onFinally = () => {
 | 
			
		||||
			if (--pending === 0) spinner.parentNode.removeChild(spinner);
 | 
			
		||||
			if (!silent) {
 | 
			
		||||
				if (--pending === 0) spinner.parentNode.removeChild(spinner);
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		const promise = new Promise((resolve, reject) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue