From e9d6ac12e12280d424401974f6efdd7f6e8be92f Mon Sep 17 00:00:00 2001 From: Avior Date: Wed, 25 Mar 2020 15:50:08 +0100 Subject: [PATCH] Added a default Language setting for global lang Signed-off-by: Avior --- tcgdex.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tcgdex.ts b/tcgdex.ts index 9a7e0b1..dbcbf56 100644 --- a/tcgdex.ts +++ b/tcgdex.ts @@ -5,14 +5,20 @@ import { ExpansionSingle, ExpansionList } from './interfaces/Expansion' import RequestWrapper from './Request' export default class TCGdex { - public lang: Langs = "en" + public static defaultLang: Langs = "en" + public lang?: Langs public constructor(lang?: Langs) { if (lang) this.lang = lang } + public getLang() { + return this.lang || TCGdex.defaultLang + } + + private getBaseUrl() { - return `https://api.tcgdex.net/${this.lang}` + return `https://api.tcgdex.net/${this.getLang()}` } private gbu() {