fix: adjust upstash api

This commit is contained in:
Fred
2024-03-13 23:58:28 +08:00
parent 61ce3868b5
commit 9a8497299d
2 changed files with 81 additions and 5 deletions

View File

@@ -85,17 +85,21 @@ export function createUpstashClient(store: SyncStore) {
};
},
path(path: string) {
let url = config.endpoint;
// let url = config.endpoint;
if (!url.endsWith("/")) {
url += "/";
if (!path.endsWith("/")) {
path += "/";
}
if (path.startsWith("/")) {
path = path.slice(1);
}
return url + path;
let url = new URL("/api/" + path);
// add query params
url.searchParams.append("endpoint", config.endpoint);
return url.toString();
},
};
}