Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(({ data }) => {
if (!isEmpty(data) && !isEmpty(data.data)) {
this.page += 1;
this.posts.push(...data.data);
$state.loaded();
} else {
$state.complete();
}
if (isEmpty($state)) {
NProgress.inc();
}
})
.catch(() => {
.then(({ data }) => {
this.topic = data;
NProgress.inc();
})
.catch(() => {
.then(({ data }) => {
this.tags = data;
NProgress.inc();
})
.catch(() => {
.then(({ data }) => {
this.user = data;
NProgress.inc();
})
.catch(() => {
done: () => {
if (isClient && NProgress) {
loadingProgressBar.requests -= 1;
if (loadingProgressBar.requests <= 0) {
NProgress.done();
return;
}
NProgress.inc(0.1);
}
}
};
function done() {
nesting--;
if (nesting > 0) {
nprogress.inc();
} else {
nprogress.done();
}
}
import Vue from 'vue';
import App from './App';
import Axios from './utils/axios';
import Router from 'vue-router';
import Music from './components/Music';
import Rank from './components/Rank';
import Station from './components/Station';
import Index from './components/Index';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import '../static/css/reset.css';
import 'vue-swipe/dist/vue-swipe.css';
import VueLazyload from 'vue-lazyload';
NProgress.inc(0.2);
NProgress.configure({ easing: 'ease', speed: 500, showSpinner: false });
Vue.use(VueLazyload, {
preLoad: 1.3,
error: './static/img/error.jpg',
loading: './static/img/loading.png',
attempt: 1,
listenEvents: [ 'scroll', 'mousewheel' ]
});
Vue.use(Router);
const routes = [{
path: '/',
component: Index
}, {
path: '/music',
const handleSubmit = async (e: FormEvent) => {
NProgress.start();
e.preventDefault();
const response = await fetch(API_SERVERS, {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ ip: value }),
});
NProgress.inc();
if (response.status === 200) {
const server = (await response.json()) as All;
onAdd(server);
toast.notify(
`${server.core.hn} (${server.core.gm}) submitted to the index!`,
{
title: "Server Submitted!",
}
);
} else {
const error = (await response.json()) as { error: string };
toast.notify(`Status ${response.statusText}: ${error?.error}`, {
title: "Submission failed!",
type: "error",
});
}
componentWillReceiveProps(nextProps) {
const { tasks } = nextProps;
if (tasks === 0) {
NProgress.done();
} else {
NProgress.inc();
}
}
.then(({ data }) => {
this.publishedCount = data.publishedCount;
this.draftCount = data.draftCount;
if (!isEmpty(data) && !isEmpty(data.posts.data)) {
this.page += 1;
this.posts.push(...data.posts.data);
$state.loaded();
} else {
$state.complete();
}
if (isEmpty($state)) {
NProgress.inc();
}
})
.catch(() => {