Skip to content

Commit

Permalink
fix(animgarden): get detail
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jan 16, 2024
1 parent 26a2fce commit 02ff03a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/animegarden/src/garden/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export async function fetchResourceDetail(
options: FetchResourceDetailOptions = {}
): Promise<(ResourceDetail & { id: number }) | undefined> {
const { baseURL = DefaultBaseURL, retry = 1 } = options;
const url = new URL(`detail/${provider}/${href}`, baseURL);
const url = new URL(`${provider}/detail/${href}`, baseURL);

const resp = await retryFn(async () => {
const resp = await fetch(url.toString(), { signal: options.signal });
Expand Down
4 changes: 4 additions & 0 deletions packages/server/scripts/admin.http
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ Content-Type: application/json
###
GET http://0.0.0.0:8080/resources
Content-Type: application/json

###
GET http://0.0.0.0:8080/dmhy/detail/660700
Content-Type: application/json
10 changes: 8 additions & 2 deletions packages/server/src/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export function registerQuery() {
app.post(`/resources`, async (ctx) => {
return listResourcesHandler(ctx);
});
app.get(`/detail/:href`, async (ctx) => {});
app.get(`/resource/:href`, async (ctx) => {});

app.get(`/dmhy/resources`, async (ctx) => {
return listResourcesHandler(ctx, 'dmhy');
Expand All @@ -43,6 +41,12 @@ export function registerQuery() {
app.get(`/dmhy/resource/:href`, async (ctx) => {
return getDmhyResourceDetail(ctx);
});
app.get(`/detail/dmhy/:href`, async (ctx) => {
return getDmhyResourceDetail(ctx);
});
app.get(`/resource/dmhy/:href`, async (ctx) => {
return getDmhyResourceDetail(ctx);
});

app.get(`/moe/resources`, async (ctx) => {
return listResourcesHandler(ctx, 'moe');
Expand All @@ -52,5 +56,7 @@ export function registerQuery() {
});
app.get(`/moe/detail/:href`, async (ctx) => {});
app.get(`/moe/resource/:href`, async (ctx) => {});
app.get(`/detail/moe/:href`, async (ctx) => {});
app.get(`/resource/moe/:href`, async (ctx) => {});
});
}

0 comments on commit 02ff03a

Please sign in to comment.