@peable/services
Advanced tools
Comparing version 0.0.45 to 0.0.46
@@ -12,3 +12,5 @@ interface SessionData { | ||
} | ||
declare const usePeableSession: () => { | ||
declare const usePeableSession: (config: { | ||
SERVICES_URL: string; | ||
}) => { | ||
session: SessionData | null; | ||
@@ -15,0 +17,0 @@ status: "loading" | "loaded"; |
import { useState, useEffect } from "react"; | ||
import axios from "axios"; | ||
const usePeableSession = () => { | ||
const usePeableSession = (config) => { | ||
const PEABLE_SERVICES_URL = process.env.PEABLE_SERVICES_URL; | ||
@@ -14,3 +14,3 @@ const [session, setSession] = useState(null); | ||
// Fetch token from Peable Auth | ||
const response = await axios.post(PEABLE_SERVICES_URL + "/api/login", { | ||
const response = await axios.post(config.SERVICES_URL + "/api/login", { | ||
// Your login credentials (e.g., username, password) | ||
@@ -22,3 +22,3 @@ }); | ||
// Session retrieval (as before) | ||
const sessionResponse = await axios.get(PEABLE_SERVICES_URL + "/api/auth/session", { | ||
const sessionResponse = await axios.get(config.SERVICES_URL + "/api/auth/session", { | ||
withCredentials: true, | ||
@@ -25,0 +25,0 @@ }); |
{ | ||
"name": "@peable/services", | ||
"version": "0.0.45", | ||
"version": "0.0.46", | ||
"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
5325
95