/*
Copyright (c) 2023 artegoser (Artemy Egorov)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
import { useState } from "react";
import { useParams } from "react-router-dom";
import { ChevronDoubleLeftIcon } from "@heroicons/react/24/outline";
import { ButtonWithIcon } from "../components/button";
import { CopyToClipboard } from "../components/copytocb";
import Note from "../components/note";
function PubNoteSafe() {
let params = useParams();
let [note, setNote] = useState(false);
let nullNote = {
text: locals.PubNoteNotExist,
name: locals.Idontexists,
time: Date.now(),
code: 0,
};
if (note === false)
fetch(`/get-note/safe/${params.id}`)
.then((data) => {
data
.json()
.then((data) => {
data.code = 1;
setNote(data);
})
.catch(() => {
setNote(nullNote);
});
})
.catch(() => {
setNote(nullNote);
});
return (
{note?.code === 1 && (
{locals.PubUrlPlaceholder}
)}
);
}
export default PubNoteSafe;