Move to dev brach

This commit is contained in:
1ilit
2024-01-14 01:16:44 +02:00
parent 6ae3406644
commit f7ca474d97

View File

@@ -64,7 +64,7 @@ import { Editor } from "@monaco-editor/react";
import { db } from "../data/db"; import { db } from "../data/db";
import { useLiveQuery } from "dexie-react-hooks"; import { useLiveQuery } from "dexie-react-hooks";
import { socket } from "../data/socket"; import { socket } from "../data/socket";
import { useCookies } from "react-cookie"; // import { useCookies } from "react-cookie";
import axios from "axios"; import axios from "axios";
export default function ControlPanel({ export default function ControlPanel({
@@ -110,7 +110,7 @@ export default function ControlPanel({
message: "", message: "",
}); });
const [data, setData] = useState(null); const [data, setData] = useState(null);
const [cookies] = useCookies(["logged_in"]); // const [cookies] = useCookies(["logged_in"]);
const [addPeople, setAddPeople] = useState([]) const [addPeople, setAddPeople] = useState([])
const { layout, setLayout } = useContext(LayoutContext); const { layout, setLayout } = useContext(LayoutContext);
const { settings, setSettings } = useContext(SettingsContext); const { settings, setSettings } = useContext(SettingsContext);
@@ -1293,26 +1293,29 @@ export default function ControlPanel({
createNewDiagram(selectedTemplateId); createNewDiagram(selectedTemplateId);
return; return;
case MODAL.SHARE: case MODAL.SHARE:
await axios // if (cookies.logged_in) {
.post( await axios
`${import.meta.env.VITE_API_BACKEND_URL}/share`, .post(
{ `${import.meta.env.VITE_API_BACKEND_URL}/share`,
people: addPeople, {
diagram: { people: addPeople,
name: title, diagram: JSON.stringify({
tables: tables, name: title,
references: relationships, tables: tables,
types: types, references: relationships,
notes: notes, types: types,
areas: areas, notes: notes,
} areas: areas,
}, })
{ withCredentials: true } },
) // { withCredentials: true }
.then((res) => { )
console.log(res) .then((res) => {
}) console.log(res)
.catch((e) => console.log(e)); // window.location = window.location + '/sup'
})
.catch((e) => console.log(e));
// }
setVisible(MODAL.NONE) setVisible(MODAL.NONE)
return; return;
default: default:
@@ -1583,7 +1586,7 @@ export default function ControlPanel({
); );
} }
case MODAL.SHARE: case MODAL.SHARE:
if (cookies.logged_in) { // if (cookies.logged_in) {
return <div> return <div>
<TagInput <TagInput
placeholder='Add people' placeholder='Add people'
@@ -1602,11 +1605,11 @@ export default function ControlPanel({
<div className="opacity-60">Owner</div> <div className="opacity-60">Owner</div>
</div> </div>
</div> </div>
} else { // } else {
return <div> // return <div>
You&apos;ll need to <Link to="/login" target="_blank" className="text-blue-600 font-bold hover:underline">log in</Link> before you can share this diagram. // You&apos;ll need to <Link to="/login" target="_blank" className="text-blue-600 font-bold hover:underline">log in</Link> before you can share this diagram.
</div> // </div>
} // }
default: default:
return <></>; return <></>;
} }