Skip to content

Commit

Permalink
chore: ♻️ make urlPrefix protected getter
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRill00 committed Mar 25, 2024
1 parent c2ca919 commit 87a250e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/models/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ export class Order {
* @throws { PrintOneError } If the order could not be refreshed.
*/
public async refresh(): Promise<void> {
const urlPrefix = this.batchId ? `batches/${this.batchId}/` : "";
this._data = await this._protected.client.GET<IOrder>(
`${urlPrefix}orders/${this.id}`,
`${this.urlPrefix}orders/${this.id}`,
);
}

Expand Down Expand Up @@ -179,10 +178,13 @@ export class Order {
time++;
}

const urlPrefix = this.batchId ? `batches/${this.batchId}/` : "";
this._data = await this._protected.client.POST<IOrder>(
`${urlPrefix}orders/${this.id}/cancel`,
`${this.urlPrefix}orders/${this.id}/cancel`,
{},
);
}

protected get urlPrefix(): string {
return this.batchId ? `batches/${this.batchId}/` : "";;
}
}

0 comments on commit 87a250e

Please sign in to comment.