fix(dashboard): show error message returned by api in discord login page
This commit is contained in:
parent
b04b6e38d2
commit
6c4bd2cc26
@ -12,7 +12,12 @@
|
|||||||
const paramkeys = [...params.keys()];
|
const paramkeys = [...params.keys()];
|
||||||
if (paramkeys.includes("code"))
|
if (paramkeys.includes("code"))
|
||||||
{
|
{
|
||||||
const res = await api().private.discord.callback.post({ data: { code: params.get("code"), redirect_domain: window.location.origin } });
|
let res: any;
|
||||||
|
try {
|
||||||
|
res = await api().private.discord.callback.post({ data: { code: params.get("code"), redirect_domain: window.location.origin } });
|
||||||
|
} catch(e) {
|
||||||
|
text = "Error: " + e.data.error;
|
||||||
|
}
|
||||||
localStorage.setItem("pk-token", res.token);
|
localStorage.setItem("pk-token", res.token);
|
||||||
localStorage.setItem("pk-user", JSON.stringify(res.system));
|
localStorage.setItem("pk-user", JSON.stringify(res.system));
|
||||||
localStorage.setItem("pk-config", JSON.stringify(res.config));
|
localStorage.setItem("pk-config", JSON.stringify(res.config));
|
||||||
|
Loading…
Reference in New Issue
Block a user