Skip to content

Commit 978b0ab

Browse files
Fixing Login Control in Extension
1 parent 1078f23 commit 978b0ab

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

src/pages/sidepanel/ActiveMeetingTab.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
updateEndTime,
1414
addAndGetMeetingInfo,
1515
getClientTranscript,
16+
getCurrentUser,
1617
} from "../../../utils/supabase";
1718
import JarvisScreen from "./JarvisScreen";
1819

@@ -162,8 +163,9 @@ const ActiveMeetingTab = () => {
162163
}
163164

164165
async function handleTokens() {
166+
const userFound = await getCurrentUser();
165167
const isSet = await areTokensSet();
166-
if (isSet) setLoggedIn(true);
168+
if (isSet && userFound) setLoggedIn(true);
167169
}
168170

169171
useEffect(() => {
@@ -381,7 +383,7 @@ const ActiveMeetingTab = () => {
381383
) : (
382384
<div className="w-full flex">
383385
<button
384-
className="p-2 px-4 bg-gray-500 rounded-md mx-auto"
386+
className="p-2 px-4 m-2 bg-gray-500 rounded-md mx-auto"
385387
onClick={handleLogin}
386388
>
387389
LogIn

src/pages/sidepanel/SidePanel.tsx

+21-7
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,39 @@ import {
1313
updateEndTime,
1414
addAndGetMeetingInfo,
1515
getClientTranscript,
16+
getCurrentUser,
1617
} from "../../../utils/supabase";
1718
import JarvisScreen from "./JarvisScreen";
1819
import ActiveMeetingTab from "./ActiveMeetingTab";
1920

2021
const SidePanel = () => {
2122
const [isMeetingActive, setMeetingActive] = useState<boolean>(true);
23+
const [loggedIn, setLoggedIn] = useState(false);
24+
25+
useEffect(() => {
26+
handleTokens();
27+
}, []);
28+
29+
async function handleTokens() {
30+
const userFound = await getCurrentUser();
31+
const isSet = await areTokensSet();
32+
if (isSet && userFound) setLoggedIn(true);
33+
}
2234

2335
if (isMeetingActive) {
2436
return (
2537
<div>
26-
<PlaybookDropdown />
38+
{loggedIn ? <PlaybookDropdown /> : null}
2739
<ActiveMeetingTab />
2840
<div className="max-w-full w-full fixed bottom-0 p-2">
29-
<button
30-
onClick={() => setMeetingActive(false)}
31-
className="bg-red-500 text-white py-2 rounded-lg w-full"
32-
>
33-
End meeting
34-
</button>
41+
{loggedIn ? (
42+
<button
43+
onClick={() => setMeetingActive(false)}
44+
className="bg-red-500 text-white py-2 rounded-lg w-full"
45+
>
46+
End meeting
47+
</button>
48+
) : null}
3549
</div>
3650
</div>
3751
);

utils/supabase.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ export async function getCurrentUser(): Promise<null | User> {
131131
async (result) => {
132132
const authAccessToken = result["accessToken"];
133133
const authRefreshToken = result["refreshToken"];
134-
console.log("authAccessToken", authAccessToken);
135-
console.log("authRefreshToken", authRefreshToken);
136134
if (authRefreshToken && authAccessToken) {
137135
try {
138136
// set user session from access_token and refresh_token

0 commit comments

Comments
 (0)