fix: piefed login issues
This commit is contained in:
1 file changed
+12
-3
@@ -171,7 +171,11 @@ class Profile {
|
|||||||
if (this.#current.jwt) {
|
if (this.#current.jwt) {
|
||||||
site.data = undefined
|
site.data = undefined
|
||||||
|
|
||||||
const res = await userFromJwt(this.#current.jwt, this.#current.instance)
|
const res = await userFromJwt(
|
||||||
|
this.#current.jwt,
|
||||||
|
this.#current.instance,
|
||||||
|
this.#current.client,
|
||||||
|
)
|
||||||
if (!res?.user)
|
if (!res?.user)
|
||||||
toast({
|
toast({
|
||||||
content:
|
content:
|
||||||
@@ -206,7 +210,7 @@ class Profile {
|
|||||||
|
|
||||||
async add(jwt: string, instance: string, type: ClientType) {
|
async add(jwt: string, instance: string, type: ClientType) {
|
||||||
try {
|
try {
|
||||||
const user = await userFromJwt(jwt, instance)
|
const user = await userFromJwt(jwt, instance, type)
|
||||||
if (!user?.user) {
|
if (!user?.user) {
|
||||||
throw new Error('No user data received')
|
throw new Error('No user data received')
|
||||||
}
|
}
|
||||||
@@ -388,8 +392,13 @@ export const profile = new Profile()
|
|||||||
async function userFromJwt(
|
async function userFromJwt(
|
||||||
jwt: string,
|
jwt: string,
|
||||||
instance: string,
|
instance: string,
|
||||||
|
type: ClientType,
|
||||||
): Promise<{ user?: MyUserInfo; site: GetSiteResponse } | undefined> {
|
): Promise<{ user?: MyUserInfo; site: GetSiteResponse } | undefined> {
|
||||||
const sitePromise = client({ instanceURL: instance, auth: jwt }).getSite()
|
const sitePromise = client({
|
||||||
|
instanceURL: instance,
|
||||||
|
auth: jwt,
|
||||||
|
clientType: type,
|
||||||
|
}).getSite()
|
||||||
|
|
||||||
const timer = setTimeout(
|
const timer = setTimeout(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
Reference in new issue
Block a user