multi tenancy stuff
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
import { GlobalRole } from "db";
|
||||
import { render } from "../../test/utils";
|
||||
import Home from "./index";
|
||||
import useCurrentCustomer from "../core/hooks/use-current-customer";
|
||||
import useCurrentUser from "../core/hooks/use-current-user";
|
||||
|
||||
jest.mock("../core/hooks/use-current-customer");
|
||||
const mockUseCurrentCustomer = useCurrentCustomer as jest.MockedFunction<typeof useCurrentCustomer>;
|
||||
jest.mock("../core/hooks/use-current-user");
|
||||
const mockUseCurrentUser = useCurrentUser as jest.MockedFunction<typeof useCurrentUser>;
|
||||
|
||||
test.skip("renders blitz documentation link", () => {
|
||||
// This is an example of how to ensure a specific item is in the document
|
||||
@ -11,16 +12,14 @@ test.skip("renders blitz documentation link", () => {
|
||||
// when you remove the the default content from the page
|
||||
|
||||
// This is an example on how to mock api hooks when testing
|
||||
mockUseCurrentCustomer.mockReturnValue({
|
||||
customer: {
|
||||
mockUseCurrentUser.mockReturnValue({
|
||||
organization: undefined,
|
||||
user: {
|
||||
id: uuidv4(),
|
||||
encryptionKey: "",
|
||||
accountSid: null,
|
||||
authToken: null,
|
||||
twimlAppSid: null,
|
||||
paddleCustomerId: null,
|
||||
paddleSubscriptionId: null,
|
||||
user: {} as any,
|
||||
name: "name",
|
||||
email: "email@test.com",
|
||||
role: GlobalRole.CUSTOMER,
|
||||
memberships: [],
|
||||
},
|
||||
hasFilledTwilioCredentials: false,
|
||||
hasCompletedOnboarding: undefined,
|
||||
|
@ -4,7 +4,7 @@ import { Link, useMutation, Routes } from "blitz";
|
||||
|
||||
import BaseLayout from "../core/layouts/base-layout";
|
||||
import logout from "../auth/mutations/logout";
|
||||
import useCurrentCustomer from "../core/hooks/use-current-customer";
|
||||
import useCurrentUser from "../core/hooks/use-current-user";
|
||||
|
||||
/*
|
||||
* This file is just for a pleasant getting started page for your new app.
|
||||
@ -12,10 +12,10 @@ import useCurrentCustomer from "../core/hooks/use-current-customer";
|
||||
*/
|
||||
|
||||
const UserInfo = () => {
|
||||
const { customer } = useCurrentCustomer();
|
||||
const { user } = useCurrentUser();
|
||||
const [logoutMutation] = useMutation(logout);
|
||||
|
||||
if (customer) {
|
||||
if (user) {
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
@ -27,9 +27,9 @@ const UserInfo = () => {
|
||||
Logout
|
||||
</button>
|
||||
<div>
|
||||
User id: <code>{customer.id}</code>
|
||||
User id: <code>{user.id}</code>
|
||||
<br />
|
||||
User role: <code>{customer.encryptionKey}</code>
|
||||
User role: <code>{user.role}</code>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
Reference in New Issue
Block a user