mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-28 17:43:05 -04:00
fix 3 places where API URLs were not constructed by function route (#451)
* Fixed 3 places where API URLs were not constructed by function route(path, params).
* autofix
---------
Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
Former-commit-id: 06eb6c1f91
This commit is contained in:
parent
4b071bccda
commit
0eb0b283b2
4 changed files with 12 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
import { Requests } from "../../requests";
|
||||
import { route } from ".";
|
||||
|
||||
const ZERO_DATE = "0001-01-01T00:00:00Z";
|
||||
|
||||
|
@ -70,12 +71,12 @@ export class BaseAPI {
|
|||
this.attachmentToken = attachmentToken;
|
||||
}
|
||||
|
||||
// if a attachmentToken is present it will be added to URL as a query param
|
||||
// if an attachmentToken is present, it will be added to URL as a query param
|
||||
// this is done with a simple appending of the query param to the URL. If your
|
||||
// URL already has a query param, this will not work.
|
||||
authURL(url: string): string {
|
||||
if (this.attachmentToken) {
|
||||
return `/api/v1${url}?access_token=${this.attachmentToken}`;
|
||||
return route(url, { access_token: this.attachmentToken });
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue