mirror of
https://github.com/docmost/docmost.git
synced 2025-11-10 14:22:07 +10:00
fix setup page redirect
This commit is contained in:
@ -61,8 +61,8 @@ export default function App() {
|
|||||||
<Routes>
|
<Routes>
|
||||||
<Route index element={<Navigate to="/home" />} />
|
<Route index element={<Navigate to="/home" />} />
|
||||||
<Route path={"/login"} element={<LoginPage />} />
|
<Route path={"/login"} element={<LoginPage />} />
|
||||||
<Route path={"/setup/register"} element={<SetupWorkspace />} />
|
|
||||||
<Route path={"/invites/:invitationId"} element={<InviteSignup />} />
|
<Route path={"/invites/:invitationId"} element={<InviteSignup />} />
|
||||||
|
<Route path={"/setup/register"} element={<SetupWorkspace />} />
|
||||||
|
|
||||||
<Route path={"/p/:pageSlug"} element={<PageRedirect />} />
|
<Route path={"/p/:pageSlug"} element={<PageRedirect />} />
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Avatar, Dialog, Group, Stack, Text } from "@mantine/core";
|
import { Dialog, Group, Stack, Text } from "@mantine/core";
|
||||||
import { useClickOutside } from "@mantine/hooks";
|
import { useClickOutside } from "@mantine/hooks";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import {
|
import {
|
||||||
@ -35,7 +35,6 @@ function CommentDialog({ editor, pageId }: CommentDialogProps) {
|
|||||||
|
|
||||||
const handleDialogClose = () => {
|
const handleDialogClose = () => {
|
||||||
setShowCommentPopup(false);
|
setShowCommentPopup(false);
|
||||||
// @ts-ignore
|
|
||||||
editor.chain().focus().unsetCommentDecoration().run();
|
editor.chain().focus().unsetCommentDecoration().run();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -48,7 +47,6 @@ function CommentDialog({ editor, pageId }: CommentDialogProps) {
|
|||||||
try {
|
try {
|
||||||
const selectedText = getSelectedText();
|
const selectedText = getSelectedText();
|
||||||
const commentData = {
|
const commentData = {
|
||||||
id: draftCommentId,
|
|
||||||
pageId: pageId,
|
pageId: pageId,
|
||||||
content: JSON.stringify(comment),
|
content: JSON.stringify(comment),
|
||||||
selection: selectedText,
|
selection: selectedText,
|
||||||
@ -58,7 +56,6 @@ function CommentDialog({ editor, pageId }: CommentDialogProps) {
|
|||||||
await createCommentMutation.mutateAsync(commentData);
|
await createCommentMutation.mutateAsync(commentData);
|
||||||
editor
|
editor
|
||||||
.chain()
|
.chain()
|
||||||
// @ts-ignore
|
|
||||||
.setComment(createdComment.id)
|
.setComment(createdComment.id)
|
||||||
.unsetCommentDecoration()
|
.unsetCommentDecoration()
|
||||||
.run();
|
.run();
|
||||||
|
|||||||
@ -86,7 +86,6 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
|
|||||||
command: () => {
|
command: () => {
|
||||||
const commentId = uuidv4();
|
const commentId = uuidv4();
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
props.editor.chain().focus().setCommentDecoration().run();
|
props.editor.chain().focus().setCommentDecoration().run();
|
||||||
setDraftCommentId(commentId);
|
setDraftCommentId(commentId);
|
||||||
setShowCommentPopup(true);
|
setShowCommentPopup(true);
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import axios, { AxiosInstance } from "axios";
|
import axios, { AxiosInstance } from "axios";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import Routes from "@/lib/app-route.ts";
|
import Routes from "@/lib/app-route.ts";
|
||||||
|
import { getBackendUrl } from "@/lib/config.ts";
|
||||||
|
|
||||||
const baseUrl = import.meta.env.DEV ? "http://localhost:3000" : "";
|
|
||||||
const api: AxiosInstance = axios.create({
|
const api: AxiosInstance = axios.create({
|
||||||
baseURL: baseUrl + "/api",
|
baseURL: getBackendUrl(),
|
||||||
});
|
});
|
||||||
|
|
||||||
api.interceptors.request.use(
|
api.interceptors.request.use(
|
||||||
@ -51,8 +51,12 @@ api.interceptors.response.use(
|
|||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes("workspace not found")
|
.includes("workspace not found")
|
||||||
) {
|
) {
|
||||||
|
console.log("workspace not found");
|
||||||
Cookies.remove("authTokens");
|
Cookies.remove("authTokens");
|
||||||
redirectToLogin();
|
|
||||||
|
if (window.location.pathname != Routes.AUTH.SETUP) {
|
||||||
|
window.location.href = Routes.AUTH.SETUP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 500:
|
case 500:
|
||||||
|
|||||||
@ -3,6 +3,7 @@ const APP_ROUTE = {
|
|||||||
AUTH: {
|
AUTH: {
|
||||||
LOGIN: "/login",
|
LOGIN: "/login",
|
||||||
SIGNUP: "/signup",
|
SIGNUP: "/signup",
|
||||||
|
SETUP: "/setup/register",
|
||||||
},
|
},
|
||||||
SETTINGS: {
|
SETTINGS: {
|
||||||
ACCOUNT: {
|
ACCOUNT: {
|
||||||
|
|||||||
Reference in New Issue
Block a user