musora-content-services 1.0.23 → 1.0.25
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 +1 -1
- package/src/services/sanity.js +10 -9
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.25](https://github.com/railroadmedia/musora-content-services/compare/v1.0.24...v1.0.25) (2024-08-14)
|
|
6
|
+
|
|
7
|
+
### [1.0.24](https://github.com/railroadmedia/musora-content-services/compare/v1.0.23...v1.0.24) (2024-08-14)
|
|
8
|
+
|
|
5
9
|
### [1.0.23](https://github.com/railroadmedia/musora-content-services/compare/v1.0.22...v1.0.23) (2024-08-14)
|
|
6
10
|
|
|
7
11
|
### [1.0.22](https://github.com/railroadmedia/musora-content-services/compare/v1.0.21...v1.0.22) (2024-08-14)
|
package/package.json
CHANGED
|
@@ -23,11 +23,11 @@ export async function fetchCurrentSongComplete(content_id) {
|
|
|
23
23
|
'Content-Type': 'application/json',
|
|
24
24
|
'X-CSRF-TOKEN': globalConfig.railcontentConfig.token
|
|
25
25
|
};
|
|
26
|
-
|
|
27
26
|
try {
|
|
28
27
|
const response = await fetch(url, { headers });
|
|
29
28
|
const result = await response.json();
|
|
30
29
|
if(result){
|
|
30
|
+
console.log('result', result[globalConfig.railcontentConfig.userId])
|
|
31
31
|
return result[globalConfig.railcontentConfig.userId];
|
|
32
32
|
}
|
|
33
33
|
} catch (error) {
|
package/src/services/sanity.js
CHANGED
|
@@ -34,19 +34,20 @@ export async function fetchSongById(songId) {
|
|
|
34
34
|
|
|
35
35
|
const songData = await fetchSanity(query, false);
|
|
36
36
|
|
|
37
|
-
// Check if the necessary user information is available in globalConfig
|
|
38
|
-
if (!songData || !globalConfig.railcontentConfig.userId || !globalConfig.railcontentConfig.token) {
|
|
39
|
-
return songData;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
37
|
// Fetch the completion state for the current song
|
|
43
38
|
const currentSongComplete = await fetchCurrentSongComplete(songId);
|
|
44
39
|
|
|
45
|
-
if (currentSongComplete) {
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
if (songData && currentSongComplete) {
|
|
41
|
+
console.log('song data', songData);
|
|
42
|
+
console.log('currentSongComplete', currentSongComplete);
|
|
43
|
+
songData.completed = currentSongComplete.state !== "not started";
|
|
44
|
+
songData.progress_percent = currentSongComplete.percent.toString();
|
|
45
|
+
} else {
|
|
46
|
+
console.log('no song data', songData);
|
|
47
|
+
console.log('no currentSongComplete', currentSongComplete);
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
console.log('all songData', songData)
|
|
50
51
|
return songData;
|
|
51
52
|
}
|
|
52
53
|
|