diff --git a/frontend/src/views/Whitelabel.svelte b/frontend/src/views/Whitelabel.svelte index 7d9936a..2592639 100644 --- a/frontend/src/views/Whitelabel.svelte +++ b/frontend/src/views/Whitelabel.svelte @@ -265,13 +265,19 @@ async function loadBot() { const res = await axios.get(`${API_URL}/user/whitelabel/`); if (res.status !== 200 || !res.data.success) { + if (res.status === 402) { + window.location.replace("https://ticketsbot.net/premium"); + return false; + } + if (res.status !== 404) { notifyError(res.data.error); } - return; + return true; } bot = res.data; + return true; } async function loadErrors() { @@ -330,24 +336,8 @@ notifySuccess('Slash commands have been created. Please note, Discord may take up to an hour to show them in your client'); } - async function checkPremium() { - const res = await axios.get(`${API_URL}/api/${guildId}/premium`); - if (res.status !== 200) { - notifyError(res.data.error); - return; - } - - let isWhitelabel = res.data.tier >= 1; - if (!isWhitelabel) { - window.location.replace("https://ticketsbot.net/premium"); - } - - return isWhitelabel; - } - withLoadingScreen(async () => { - if (await checkPremium()) { - await loadBot(); + if (await loadBot()) { await loadErrors(); await loadInteractionUrl(); await loadPublicKey(); diff --git a/go.mod b/go.mod index d5c1c20..1ab5fab 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/jackc/pgx/v4 v4.7.1 github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c github.com/pkg/errors v0.9.1 - github.com/rxdn/gdl v0.0.0-20210629143956-f248d37cb604 + github.com/rxdn/gdl v0.0.0-20210701115435-816eb486d5d0 github.com/sirupsen/logrus v1.5.0 github.com/ulule/limiter/v3 v3.5.0 golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a