18 lines
No EOL
545 B
TypeScript
18 lines
No EOL
545 B
TypeScript
import { component$ } from "@builder.io/qwik";
|
|
import { routeLoader$ } from "@builder.io/qwik-city";
|
|
import { OAUTH_LINK } from "~/lib/constants";
|
|
|
|
export const useAuthCheck = routeLoader$(({ cookie, redirect: r }) => {
|
|
const jwt = cookie.get("jwt");
|
|
if (!jwt) return {};
|
|
|
|
throw r(302, "/dashboard");
|
|
});
|
|
|
|
export default component$(() => {
|
|
return (
|
|
<div class="flex flex-col items-center justify-center flex-grow">
|
|
<a href={OAUTH_LINK} class="bg-white text-black p-2 rounded-lg">clik heir 2 auth!!!!!!</a>
|
|
</div>
|
|
);
|
|
}); |