@caseparts-org/casecore 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  export interface AuthContextValue {
3
3
  initialized: string;
4
- login: (email: string, password: string) => void;
4
+ login: (_email: string, _password: string) => void;
5
+ user: string | null;
5
6
  }
7
+ export declare const AuthContext: React.Context<AuthContextValue | undefined>;
6
8
  export declare const useAuthContext: () => AuthContextValue;
7
9
  export interface AuthProviderProps {
8
10
  children: React.ReactNode;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useContext, useState } from "react";
3
- const AuthContext = createContext(undefined);
3
+ export const AuthContext = createContext(undefined);
4
4
  export const useAuthContext = () => {
5
5
  const ctx = useContext(AuthContext);
6
6
  if (!ctx)
@@ -8,11 +8,14 @@ export const useAuthContext = () => {
8
8
  return ctx;
9
9
  };
10
10
  export const AuthProvider = ({ children, apiKey, loginUrl, }) => {
11
- const [initialized, setInitialized] = useState("OK");
11
+ const [initialized] = useState("OK");
12
+ const [user, setUser] = useState(null);
12
13
  const login = (email, password) => {
13
- console.log({ email, password });
14
+ // Use both email and password to avoid unused variable error
15
+ console.log(`Logging in with email: ${email} and password: ${password}`);
16
+ setUser(`${email}.${password}`);
14
17
  };
15
18
  console.log(apiKey);
16
19
  console.log(loginUrl);
17
- return (_jsx(AuthContext.Provider, { value: { initialized, login }, children: children }));
20
+ return (_jsx(AuthContext.Provider, { value: { initialized, login, user }, children: children }));
18
21
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/casecore",
3
3
  "private": false,
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",