mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-04-22 10:42:10 +00:00
Added a default Language setting for global lang
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
5ac1a18f6f
commit
e9d6ac12e1
10
tcgdex.ts
10
tcgdex.ts
@ -5,14 +5,20 @@ import { ExpansionSingle, ExpansionList } from './interfaces/Expansion'
|
|||||||
import RequestWrapper from './Request'
|
import RequestWrapper from './Request'
|
||||||
|
|
||||||
export default class TCGdex {
|
export default class TCGdex {
|
||||||
public lang: Langs = "en"
|
public static defaultLang: Langs = "en"
|
||||||
|
public lang?: Langs
|
||||||
|
|
||||||
public constructor(lang?: Langs) {
|
public constructor(lang?: Langs) {
|
||||||
if (lang) this.lang = lang
|
if (lang) this.lang = lang
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getLang() {
|
||||||
|
return this.lang || TCGdex.defaultLang
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private getBaseUrl() {
|
private getBaseUrl() {
|
||||||
return `https://api.tcgdex.net/${this.lang}`
|
return `https://api.tcgdex.net/${this.getLang()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private gbu() {
|
private gbu() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user