mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-01 19:59:44 +00:00
chore: add cookies
This commit is contained in:
@ -7,6 +7,7 @@ import { authServiceClient } from "@/grpcweb";
|
||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||
import useUserStore from "@/stores/v1/user";
|
||||
import useWorkspaceStore from "@/stores/v1/workspace";
|
||||
import { setAccessToken } from "@/utils/auth";
|
||||
import useLoading from "../hooks/useLoading";
|
||||
|
||||
const SignIn: React.FC = () => {
|
||||
@ -47,7 +48,7 @@ const SignIn: React.FC = () => {
|
||||
const { user, accessToken } = await authServiceClient.signIn({ email, password });
|
||||
if (user) {
|
||||
userStore.setCurrentUserId(user.id);
|
||||
document.cookie = `slash.access-token=${accessToken}; path=/;`;
|
||||
setAccessToken(accessToken);
|
||||
await userStore.fetchCurrentUser();
|
||||
navigateTo("/");
|
||||
} else {
|
||||
|
@ -7,6 +7,7 @@ import { authServiceClient } from "@/grpcweb";
|
||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||
import useUserStore from "@/stores/v1/user";
|
||||
import useWorkspaceStore from "@/stores/v1/workspace";
|
||||
import { setAccessToken } from "@/utils/auth";
|
||||
import useLoading from "../hooks/useLoading";
|
||||
|
||||
const SignUp: React.FC = () => {
|
||||
@ -58,7 +59,7 @@ const SignUp: React.FC = () => {
|
||||
});
|
||||
if (user) {
|
||||
userStore.setCurrentUserId(user.id);
|
||||
document.cookie = `slash.access-token=${accessToken}; path=/;`;
|
||||
setAccessToken(accessToken);
|
||||
await userStore.fetchCurrentUser();
|
||||
navigateTo("/");
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user