mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Updated save method for websites.
This commit is contained in:
parent
dcf16e1411
commit
2428314f58
3 changed files with 26 additions and 20 deletions
|
|
@ -14,6 +14,7 @@ import useApi from 'hooks/useApi';
|
|||
import useFetch from 'hooks/useFetch';
|
||||
import useUser from 'hooks/useUser';
|
||||
import styles from './WebsiteEditForm.module.css';
|
||||
import { getRandomChars } from 'next-basics';
|
||||
|
||||
const initialValues = {
|
||||
name: '',
|
||||
|
|
@ -78,7 +79,10 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
|
|||
const [message, setMessage] = useState();
|
||||
|
||||
const handleSubmit = async values => {
|
||||
const { website_id } = values;
|
||||
const { website_id, enable_share_url, share_id } = values;
|
||||
if (enable_share_url) {
|
||||
values.share_id = share_id || getRandomChars(8);
|
||||
}
|
||||
const { ok, data } = await post(website_id ? `/websites/${website_id}` : '/websites', values);
|
||||
|
||||
if (ok) {
|
||||
|
|
@ -137,7 +141,6 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
|
|||
defaultMessage="Enable share URL"
|
||||
/>
|
||||
}
|
||||
value={null}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue