-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Import Package page to catalog #1421
base: main
Are you sure you want to change the base?
Conversation
A live preview of this PR will be available at the URL below and will update on each commit. = https://pr1421---site-khswqo4xea-wl.a.run.app/
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a test? Lots of things could go wrong here, e.g. the graphql query is unvalidated I believe?
export class WCOCatalogImportPage extends WCOPage { | ||
private _importTask = new Task(this, { | ||
task: async ([packageName]: [packageName: string | undefined]) => { | ||
console.log('_importTask', packageName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove log?
packageName, | ||
}), | ||
}); | ||
const result = await response.json(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we need to check the response code before parsing the json? Since fetch doesn't throw on HTTP errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can let .json()
throw and add a error template.
unknown | ||
> | ||
) => { | ||
console.log('context.request.body', context.request.body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove log
This adds a
/catalog/import
GET endpoint for the import page and POST endpoint for the import operation.The page is extremely basic and just dumps the JSON output of the response to the screen.
Did a few cleanups on route file organization to make things simpler too.