diff --git a/src/server/paloalto/PaFirewall.ts b/src/server/paloalto/PaFirewall.ts index 0c7db07..0a810cc 100644 --- a/src/server/paloalto/PaFirewall.ts +++ b/src/server/paloalto/PaFirewall.ts @@ -5,19 +5,15 @@ export class PaFirewall { async mapUserIDToIP(username: string, ip: string, domain: string) { const command = this.createCommand(username, ip, domain) + const url = `https://${this.ip}/api/?type=user-id&key=${this.key}&cmd=${command}` - const response = await fetch( - `https://${this.ip}/api/?type=user-id&key=${this.key}&cmd=${command}`, - { - method: 'POST' - } - ) + const response = await fetch(url, { method: 'POST' }) const data = await response.text() - const result = data.includes('status="success"') + const success = data.includes('status="success"') - if (!result) { + if (!success) { console.log(data) throw new Error('Failed to map user ID to IP') }