mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-29 12:10:24 +00:00
Initial commit of eigent-main
This commit is contained in:
commit
723df5a03e
1144 changed files with 103478 additions and 0 deletions
30
package/@stackframe/react/dist/esm/lib/hooks.js
vendored
Normal file
30
package/@stackframe/react/dist/esm/lib/hooks.js
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// src/lib/hooks.tsx
|
||||
import { useContext } from "react";
|
||||
import { StackContext } from "../providers/stack-provider-client";
|
||||
function useUser(options = {}) {
|
||||
const stackApp = useStackApp(options);
|
||||
if (options.projectIdMustMatch && stackApp.projectId !== options.projectIdMustMatch) {
|
||||
throw new Error("Unexpected project ID in useStackApp: " + stackApp.projectId);
|
||||
}
|
||||
if (options.projectIdMustMatch === "internal") {
|
||||
return stackApp.useUser(options);
|
||||
} else {
|
||||
return stackApp.useUser(options);
|
||||
}
|
||||
}
|
||||
function useStackApp(options = {}) {
|
||||
const context = useContext(StackContext);
|
||||
if (context === null) {
|
||||
throw new Error("useStackApp must be used within a StackProvider");
|
||||
}
|
||||
const stackApp = context.app;
|
||||
if (options.projectIdMustMatch && stackApp.projectId !== options.projectIdMustMatch) {
|
||||
throw new Error("Unexpected project ID in useStackApp: " + stackApp.projectId);
|
||||
}
|
||||
return stackApp;
|
||||
}
|
||||
export {
|
||||
useStackApp,
|
||||
useUser
|
||||
};
|
||||
//# sourceMappingURL=hooks.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue