Spaces:
Running
Running
Update src/services/horoscopeService.js
Browse files
src/services/horoscopeService.js
CHANGED
|
@@ -27,9 +27,8 @@ export const fetchHoroscopeData = async (category, period) => {
|
|
| 27 |
try {
|
| 28 |
const currentDate = getCurrentDate();
|
| 29 |
const fileName = `${category}_${period}.json`;
|
| 30 |
-
const url = `https://api.github.com/repos/
|
| 31 |
|
| 32 |
-
// Chuẩn bị headers với token
|
| 33 |
const headers = {
|
| 34 |
Accept: "application/vnd.github.v3+json",
|
| 35 |
};
|
|
@@ -56,12 +55,9 @@ export const fetchHoroscopeData = async (category, period) => {
|
|
| 56 |
|
| 57 |
const githubResponse = await response.json();
|
| 58 |
|
| 59 |
-
// GitHub API trả về content dạng base64, cần decode UTF-8 đúng cách
|
| 60 |
if (githubResponse.content) {
|
| 61 |
-
// Loại bỏ line breaks trong base64 content
|
| 62 |
const cleanBase64 = githubResponse.content.replace(/\n/g, "");
|
| 63 |
|
| 64 |
-
// Decode base64 với UTF-8 support
|
| 65 |
const decodedContent = decodeBase64UTF8(cleanBase64);
|
| 66 |
|
| 67 |
if (!decodedContent) {
|
|
|
|
| 27 |
try {
|
| 28 |
const currentDate = getCurrentDate();
|
| 29 |
const fileName = `${category}_${period}.json`;
|
| 30 |
+
const url = `https://api.github.com/repos/preview4r/AstroLens-Horoscope-Data-Storage/contents/data/${currentDate}/${fileName}`;
|
| 31 |
|
|
|
|
| 32 |
const headers = {
|
| 33 |
Accept: "application/vnd.github.v3+json",
|
| 34 |
};
|
|
|
|
| 55 |
|
| 56 |
const githubResponse = await response.json();
|
| 57 |
|
|
|
|
| 58 |
if (githubResponse.content) {
|
|
|
|
| 59 |
const cleanBase64 = githubResponse.content.replace(/\n/g, "");
|
| 60 |
|
|
|
|
| 61 |
const decodedContent = decodeBase64UTF8(cleanBase64);
|
| 62 |
|
| 63 |
if (!decodedContent) {
|