changes
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const store = useStore();
|
||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
const { $getapi, $readyapi } = nuxtApp;
|
||||
const connlist = $readyapi([
|
||||
"common",
|
||||
@@ -19,7 +18,6 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
async function getReady() {
|
||||
try {
|
||||
await $getapi(notReadyConns);
|
||||
store.ready = true;
|
||||
} catch (error) {
|
||||
showError({
|
||||
statusCode: 500,
|
||||
@@ -27,5 +25,5 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
if (notReadyConns.length > 0) getReady();
|
||||
if (notReadyConns.length > 0) await getReady();
|
||||
});
|
||||
|
||||
12
app/plugins/05-artificial-delay.js
Normal file
12
app/plugins/05-artificial-delay.js
Normal file
@@ -0,0 +1,12 @@
|
||||
export default defineNuxtPlugin(async () => {
|
||||
const loadTime = performance.now();
|
||||
const minDuration = 2000;
|
||||
|
||||
if (loadTime < minDuration) {
|
||||
await new Promise((r) => setTimeout(r, minDuration - loadTime));
|
||||
}
|
||||
|
||||
// nuxtApp.hook('app:mounted', () => {
|
||||
// console.log('app.mount() completed at', performance.now())
|
||||
// });
|
||||
});
|
||||
Reference in New Issue
Block a user