@peable/services
Advanced tools
Comparing version 0.0.49 to 0.0.50
@@ -17,3 +17,3 @@ interface SessionData { | ||
session: SessionData | null; | ||
status: "loading" | "loaded"; | ||
status: "loading" | "authenticated" | "unauthenticated"; | ||
error: string | null; | ||
@@ -20,0 +20,0 @@ }; |
@@ -12,2 +12,4 @@ import { useState, useEffect } from "react"; | ||
if (!storedToken) { | ||
setSession(null); | ||
setStatus("unauthenticated"); | ||
// Fetch token from Peable Auth | ||
@@ -24,3 +26,10 @@ const response = await axios.post(config.SERVICES_URL + "/api/login", { | ||
}); | ||
setSession(sessionResponse.data); | ||
if (sessionResponse?.data) { | ||
setSession(sessionResponse.data); | ||
setStatus("authenticated"); | ||
} | ||
else { | ||
setSession(null); | ||
setStatus("unauthenticated"); | ||
} | ||
} | ||
@@ -34,6 +43,5 @@ catch (error) { | ||
} | ||
setSession(null); | ||
setStatus("unauthenticated"); | ||
} | ||
finally { | ||
setStatus("loaded"); | ||
} | ||
}; | ||
@@ -40,0 +48,0 @@ loadSession(); |
{ | ||
"name": "@peable/services", | ||
"version": "0.0.49", | ||
"version": "0.0.50", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5723
103