Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 8a98ebb

Browse files
committed
fixed issues on response codes other than 200
1 parent 03f731a commit 8a98ebb

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

apiRunner.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//Version
2-
var scriptVersion = 'v0.2.5';
2+
var scriptVersion = 'v0.2.6';
33
document.getElementById('app-version').innerHTML = scriptVersion;
44
//API url
55
var apiUrl = 'https://mixer.com/api/v1/';
@@ -18,11 +18,17 @@ function Get(url) {
1818
var Httpreq = new XMLHttpRequest();
1919
Httpreq.open("GET", url, false);
2020
Httpreq.send(null);
21-
var response = JSON.parse(Httpreq.responseText);
2221
var statusCode = Httpreq.status;
23-
response.statusCode = statusCode;
24-
console.log(response)
25-
return response
22+
if (statusCode !== 200) {
23+
var response = {"statusCode": statusCode}
24+
return response
25+
}
26+
else {
27+
var response = JSON.parse(Httpreq.responseText);
28+
response.statusCode = statusCode;
29+
console.log(response)
30+
return response
31+
}
2632
}
2733

2834
//Return Lightstream status from id(aka ChannelId)
@@ -46,6 +52,7 @@ function parseXuid(channelId) {
4652
console.log('Parsing Lighstream')
4753
videoUrl = `${apiUrl}users/${channelId}/xuid`;
4854
var rawData = Get(videoUrl);
55+
console.log(rawData)
4956
if (rawData['statusCode'] !== 200){xuid = `failed ${rawData['statusCode']}`;}
5057
else {
5158
var xuid = rawData['xuid'];

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name" : "catToys",
3-
"version": "0.2.5",
3+
"version": "0.2.6",
44
"manifest_version": 2,
55
"description": "A tool for looking up user information on Mixer.com",
66
"content_scripts": [

styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ General
55
*/
66
body {
77
width: 225px;
8-
height: 325px;
8+
height: 380px;
99
font-family: 'Poppins', sans-serif;
1010
}
1111
div {

0 commit comments

Comments
 (0)