-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
37 lines (34 loc) · 927 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { component$ } from "@builder.io/qwik";
import type { DocumentHead } from "@builder.io/qwik-city";
import { useSignIn, useSession, useSignOut } from '~/routes/plugin@auth';
export default component$(() => {
const session = useSession();
const signIn = useSignIn();
const signOut = useSignOut();
return (
<>
<h1>Hi 👋</h1>
<div>
Can't wait to see what you build with qwik!
<br />
Happy coding.
</div>
<button onClick$={() => {
if (session.value) {
signOut.submit({});
} else {
signIn.submit({ providerId: 'github', redirectTo: encodeURI('/završi-profil') });
}
}}>{session.value ? 'Sing out' : 'Sign in with GitHub'}</button>
</>
);
});
export const head: DocumentHead = {
title: "Welcome to Qwik",
meta: [
{
name: "description",
content: "Qwik site description",
},
],
};