Skip to content
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

🐛 Pick up query params for internal requests in vtFetch #2844

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.16.3]

### Fixed

- Pick up query params for internal requests in vtFetch [#2844](https://github.com/ViewTube/viewtube/pull/2844)

## [0.16.2]

### Added
Expand Down Expand Up @@ -457,7 +463,8 @@

- Initial release

[unreleased]: https://github.com/viewtube/viewtube/compare/v0.16.2...development
[unreleased]: https://github.com/viewtube/viewtube/compare/v0.16.3...development
[0.16.3]: https://github.com/viewtube/viewtube/compare/v0.16.2...v0.16.3
[0.16.2]: https://github.com/viewtube/viewtube/compare/v0.16.1...v0.16.2
[0.16.1]: https://github.com/viewtube/viewtube/compare/v0.16.0...v0.16.1
[0.16.0]: https://github.com/viewtube/viewtube/compare/v0.15.4...v0.16.0
Expand Down
8 changes: 7 additions & 1 deletion client/composables/vtFetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { destr } from 'destr';
import { ofetch } from 'ofetch';
import { withQuery } from 'ufo';

interface ResponseMap {
blob: Blob;
Expand Down Expand Up @@ -63,9 +64,14 @@ export const useVtFetch = () => {
}

if (import.meta.server && !options?.external && global?.nestApp) {
const requestUrl = withQuery(request.toString(), {
...(requestOptions.query ?? {}),
...(requestOptions.params ?? {})
});

const response = await global.nestApp.inject({
method: (requestOptions.method ?? 'GET') as HTTPMethods,
url: request.toString(),
url: requestUrl,
headers: requestOptions.headers as Record<string, string>,
body: requestOptions.body,
authority: 'nuxtApp'
Expand Down
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"tippy.js": "6.3.7",
"typescript": "5.4.5",
"ua-parser-js": "2.0.0-beta.3",
"ufo": "1.5.3",
"vue": "3.4.29",
"vue-datepicker-next": "1.0.3",
"vue-tsc": "1.8.27",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "moisout",
"country": "Switzerland",
"email": "viewtube@m-o.dev",
"version": "0.16.2",
"version": "0.16.3",
"license": "AGPLv3",
"engines": {
"node": ">=20.11.0",
Expand Down
11 changes: 7 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading