Issue #140:
This commit is contained in:
@@ -3,13 +3,9 @@ import loadingStore from './loading.js';
|
||||
import pinia from '@/stores/main.js'
|
||||
import axios from "axios";
|
||||
import moment from 'moment';
|
||||
import {useToast} from 'vue-toast-notification';
|
||||
import 'vue-toast-notification/dist/theme-sugar.css';
|
||||
import apiError from '@/module/apiError.js';
|
||||
|
||||
const loading = loadingStore(pinia);
|
||||
const $toast = useToast();
|
||||
// Delay loading and toast 待模組化
|
||||
let delay = s => new Promise((resolve, reject) => setTimeout(resolve, s));
|
||||
|
||||
export default defineStore('filesStore', {
|
||||
state: () => ({
|
||||
@@ -75,17 +71,7 @@ export default defineStore('filesStore', {
|
||||
})
|
||||
if(this.httpStatus < 300) loading.isLoading = false;
|
||||
} catch(error) {
|
||||
console.dir(error); // safari 測試
|
||||
this.httpStatus = error.request.status;
|
||||
delay().then(() =>{
|
||||
loading.isLoading = true;
|
||||
return delay(1000);
|
||||
}).then(()=>{
|
||||
loading.isLoading = false;
|
||||
return delay(500);
|
||||
}).then(() => {
|
||||
$toast.default('Failed to load the logs.',{position: 'bottom'});
|
||||
})
|
||||
apiError(error, 'Failed to load the logs.');
|
||||
};
|
||||
},
|
||||
/**
|
||||
@@ -108,17 +94,7 @@ export default defineStore('filesStore', {
|
||||
});
|
||||
if(this.httpStatus < 300) loading.isLoading = false;
|
||||
} catch(error) {
|
||||
console.dir(error); // safari 測試
|
||||
this.httpStatus = error.request.status;
|
||||
delay().then(() =>{
|
||||
loading.isLoading = true;
|
||||
return delay(1000);
|
||||
}).then(()=>{
|
||||
loading.isLoading = false;
|
||||
return delay(500);
|
||||
}).then(() => {
|
||||
$toast.default('Failed to load the filters.',{position: 'bottom'});
|
||||
})
|
||||
apiError(error, 'Failed to load the filters.');
|
||||
};
|
||||
},
|
||||
// fetchRule(){o.icon = local_police}
|
||||
|
||||
Reference in New Issue
Block a user