mirror of
https://github.com/VueTubeApp/VueTube
synced 2025-01-05 07:01:14 +00:00
show "error" on error logs
This commit is contained in:
parent
bdd2069a7e
commit
66a1704fb8
2 changed files with 12 additions and 7 deletions
|
@ -4,6 +4,7 @@
|
|||
<v-list-item v-for="(item, index) in logs" :key="index">
|
||||
<v-card class="card">
|
||||
<v-card-title>
|
||||
<v-chip outlined class="errorChip" color="error" v-if="item.error">Error</v-chip>
|
||||
{{ item.name }}
|
||||
<span v-text="`• ${new Date(item.time).toLocaleString()}`" class="date" />
|
||||
</v-card-title>
|
||||
|
@ -32,6 +33,9 @@
|
|||
transform: translateY(5%);
|
||||
color: #999;
|
||||
}
|
||||
.errorChip {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
import { Http } from '@capacitor-community/http';
|
||||
|
||||
//--- Logger Function ---//
|
||||
function logger(func, data) {
|
||||
function logger(func, data, isError=false) {
|
||||
module.logs.unshift({
|
||||
name: func,
|
||||
time: Date.now(),
|
||||
data: data
|
||||
data: data,
|
||||
error: isError
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -28,11 +29,11 @@ function youtubeSearch(text, callback) {
|
|||
html = html.replaceAll("\\\\\"", "");
|
||||
//--- Parse JSON ---//
|
||||
html = JSON.parse(html);
|
||||
|
||||
|
||||
//--- Get Results ---// ( Thanks To appit-online On Github ) -> https://github.com/appit-online/youtube-search/blob/master/src/lib/search.ts
|
||||
let results;
|
||||
if (html && html.contents && html.contents.sectionListRenderer && html.contents.sectionListRenderer.contents
|
||||
&& html.contents.sectionListRenderer.contents.length > 0
|
||||
&& html.contents.sectionListRenderer.contents.length > 0
|
||||
&& html.contents.sectionListRenderer.contents[0].itemSectionRenderer
|
||||
&& html.contents.sectionListRenderer.contents[0].itemSectionRenderer.contents.length > 0) {
|
||||
results = html.contents.sectionListRenderer.contents[0].itemSectionRenderer.contents;
|
||||
|
@ -55,7 +56,7 @@ function youtubeSearch(text, callback) {
|
|||
|
||||
})
|
||||
.catch((err) => {
|
||||
logger("search", err);
|
||||
logger("search", err, true);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
|
@ -75,7 +76,7 @@ const module = {
|
|||
callback(res.data);
|
||||
})
|
||||
.catch((err) => {
|
||||
logger("autoComplete", err);
|
||||
logger("autoComplete", err, true);
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
|
@ -97,7 +98,7 @@ const module = {
|
|||
}
|
||||
})
|
||||
callback(results);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue