musora-content-services 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/services/railcontent.js +6 -1
- package/src/services/sanity.js +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.26](https://github.com/railroadmedia/musora-content-services/compare/v1.0.25...v1.0.26) (2024-08-14)
|
|
6
|
+
|
|
7
|
+
### [1.0.25](https://github.com/railroadmedia/musora-content-services/compare/v1.0.24...v1.0.25) (2024-08-14)
|
|
8
|
+
|
|
5
9
|
### [1.0.24](https://github.com/railroadmedia/musora-content-services/compare/v1.0.23...v1.0.24) (2024-08-14)
|
|
6
10
|
|
|
7
11
|
### [1.0.23](https://github.com/railroadmedia/musora-content-services/compare/v1.0.22...v1.0.23) (2024-08-14)
|
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ const { globalConfig } = require('./config');
|
|
|
18
18
|
*/
|
|
19
19
|
export async function fetchCurrentSongComplete(content_id) {
|
|
20
20
|
const url = `/content/user_progress/${globalConfig.railcontentConfig.userId}?content_ids[]=${content_id}`;
|
|
21
|
+
console.log('Request URL:', url); // Debugging log
|
|
21
22
|
|
|
22
23
|
const headers = {
|
|
23
24
|
'Content-Type': 'application/json',
|
|
@@ -26,8 +27,12 @@ export async function fetchCurrentSongComplete(content_id) {
|
|
|
26
27
|
|
|
27
28
|
try {
|
|
28
29
|
const response = await fetch(url, { headers });
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
32
|
+
}
|
|
29
33
|
const result = await response.json();
|
|
30
|
-
if(result){
|
|
34
|
+
if (result) {
|
|
35
|
+
console.log('API result:', result);
|
|
31
36
|
return result[globalConfig.railcontentConfig.userId];
|
|
32
37
|
}
|
|
33
38
|
} catch (error) {
|
package/src/services/sanity.js
CHANGED
|
@@ -38,10 +38,14 @@ export async function fetchSongById(songId) {
|
|
|
38
38
|
const currentSongComplete = await fetchCurrentSongComplete(songId);
|
|
39
39
|
|
|
40
40
|
if (songData && currentSongComplete) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
console.log('currentSongComplete', currentSongComplete);
|
|
42
|
+
songData.completed = currentSongComplete.state !== "not started";
|
|
43
|
+
songData.progress_percent = currentSongComplete.percent.toString();
|
|
44
|
+
} else {
|
|
45
|
+
console.log('no currentSongComplete', currentSongComplete);
|
|
43
46
|
}
|
|
44
|
-
|
|
47
|
+
|
|
48
|
+
console.log('all songData', songData)
|
|
45
49
|
return songData;
|
|
46
50
|
}
|
|
47
51
|
|