Skip to content

Commit 93a892d

Browse files
committed
Updated Google / Microsoft links
1 parent b68d902 commit 93a892d

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/components/LoginPopup.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ export default function LoginPopup({ isOpen, onClose }: Props) {
4848

4949
<button
5050
className="popup-button"
51-
onClick={login}
51+
onClick={() => login("google")}
5252
>
5353
Continue with Google
5454
</button>
5555

5656
<button
5757
className="popup-button"
58-
onClick={login}
58+
onClick={() => login("microsoft")}
5959
>
6060
Continue with Microsoft
6161
</button>

src/context/AuthContext.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type AuthContextType = {
1010
user: User | null;
1111
loading: boolean;
1212
error: string | null;
13-
login: () => void;
13+
login: (provider: "google" | "microsoft") => void;
1414
logout: () => Promise<void>;
1515
refreshUser: () => Promise<void>;
1616
};
@@ -63,9 +63,14 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
6363
}
6464
};
6565

66-
const login = (): void => {
66+
const login = (provider: "google" | "microsoft"): void => {
6767

68-
window.open('https://api.capyrpi.org/v1/auth/google', '_blank');
68+
const url =
69+
provider === "google"
70+
? "https://api.capyrpi.org/v1/auth/google"
71+
: "https://api.capyrpi.org/v1/auth/microsoft";
72+
73+
window.open(url, "_blank");
6974

7075
const pollInterval = setInterval(async () => {
7176

@@ -93,7 +98,9 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
9398
if (err instanceof Error) {
9499
console.error('Polling failed:', err.message);
95100
}
101+
96102
}
103+
97104
}, 3000);
98105

99106
setTimeout(() => {

0 commit comments

Comments
 (0)