แก้ throw error
This commit is contained in:
parent
8c483a95a1
commit
537a388bcb
2 changed files with 47 additions and 40 deletions
|
|
@ -164,12 +164,12 @@ class CheckAuth {
|
|||
port: process.env.REDIS_PORT,
|
||||
})
|
||||
const getAsync = promisify(redisClient.get).bind(redisClient)
|
||||
let reply = await getAsync("org_" + keycloakId)
|
||||
if (reply != null) {
|
||||
reply = JSON.parse(reply)
|
||||
} else {
|
||||
try {
|
||||
if (!keycloakId) throw "Error calling API No KeycloakId"
|
||||
try {
|
||||
let reply = await getAsync("org_" + keycloakId)
|
||||
if (reply != null) {
|
||||
reply = JSON.parse(reply)
|
||||
} else {
|
||||
if (!keycloakId) throw new Error("No KeycloakId provided")
|
||||
const x = await new CallAPI().GetData(
|
||||
{
|
||||
headers: { authorization: token },
|
||||
|
|
@ -187,10 +187,10 @@ class CheckAuth {
|
|||
}
|
||||
|
||||
return data
|
||||
} catch (error) {
|
||||
console.error("Error calling API:", error)
|
||||
throw error
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error calling API:", error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
public async PermissionCreate(req: RequestWithUser, system: string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue