Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@peable/services

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peable/services - npm Package Compare versions

Comparing version 0.0.59 to 0.0.60

7

dist/hooks/usePeableSession.d.ts

@@ -13,2 +13,9 @@ interface SessionModel {

}
type SessionState = {
session: SessionModel | null;
status: string;
error: any;
fetchSessionData: () => void;
};
export declare const useSessionStore: import("zustand").UseBoundStore<import("zustand").StoreApi<SessionState>>;
declare function usePeableSession(): {

@@ -15,0 +22,0 @@ session: SessionModel | null;

52

dist/hooks/usePeableSession.js

@@ -1,38 +0,22 @@

import { useState, useEffect } from "react";
import { useEffect } from "react";
import axios from "axios";
import Cookies from "js-cookie";
import { create } from "zustand";
export const useSessionStore = create((set) => ({
session: null,
status: "loading",
error: null,
fetchSessionData: async () => {
try {
set({ status: "loading" });
const response = await axios.get("http://localhost:3001/api/session/dsfuhfsdiuhfiusdhfuisdhfiush");
set({ session: response.data, status: "success" });
}
catch (error) {
set({ error, status: "error" });
}
},
}));
function usePeableSession() {
const [status, setStatus] = useState("loading");
const [error, setError] = useState(null);
const [session, setSessionData] = useState(null);
const { session, status, error, fetchSessionData } = useSessionStore();
useEffect(() => {
const clientKey = Cookies.get("clientKey");
if (!clientKey) {
const fetchClientKey = async () => {
try {
setStatus("loading"); // Set status to "loading"
const response = await axios.get("https://accounts.peable.co/clientKey.php");
const data = response.data;
Cookies.set("clientKey", data[0], { expires: 365, path: "" });
}
catch (error) {
setError(error);
}
};
fetchClientKey();
}
}, []);
useEffect(() => {
const fetchSessionData = async () => {
try {
setStatus("loading"); // Set status to "loading"
const response = await axios.get("http://localhost:3001/api/session/dsfuhfsdiuhfiusdhfuisdhfiush");
setSessionData(response.data);
setStatus("success");
}
catch (error) {
setError(error);
setStatus("error");
}
};
fetchSessionData();

@@ -39,0 +23,0 @@ }, []);

{
"name": "@peable/services",
"version": "0.0.59",
"version": "0.0.60",
"description": "",

@@ -37,4 +37,5 @@ "main": "./dist/index.js",

"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"zustand": "^4.5.2"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc