chore: rework useSubmit (#2649)

rework useSubmit
This commit is contained in:
Bernd Storath
2026-06-03 10:08:07 +02:00
committed by GitHub
parent e03d743307
commit bc95a2851f
16 changed files with 124 additions and 127 deletions
+5 -4
View File
@@ -121,10 +121,11 @@ const { data: _data, refresh } = await useFetch(`/api/admin/userconfig`, {
const data = toRef(_data.value);
const _submit = useSubmit(
`/api/admin/userconfig`,
{
method: 'post',
},
(data) =>
$fetch(`/api/admin/userconfig`, {
method: 'post',
body: data,
}),
{ revert }
);
+5 -4
View File
@@ -46,10 +46,11 @@ const { data: _data, refresh } = await useFetch(`/api/admin/general`, {
const data = toRef(_data.value);
const _submit = useSubmit(
`/api/admin/general`,
{
method: 'post',
},
(data) =>
$fetch(`/api/admin/general`, {
method: 'post',
body: data,
}),
{ revert }
);
+5 -4
View File
@@ -40,10 +40,11 @@ const { data: _data, refresh } = await useFetch(`/api/admin/hooks`, {
const data = toRef(_data.value);
const _submit = useSubmit(
`/api/admin/hooks`,
{
method: 'post',
},
(data) =>
$fetch(`/api/admin/hooks`, {
method: 'post',
body: data,
}),
{ revert }
);
+15 -12
View File
@@ -176,10 +176,11 @@ const { data: _data, refresh } = await useFetch(`/api/admin/interface`, {
const data = toRef(_data.value);
const _submit = useSubmit(
`/api/admin/interface`,
{
method: 'post',
},
(data) =>
$fetch(`/api/admin/interface`, {
method: 'post',
body: data,
}),
{
revert: async (success) => {
await revert();
@@ -201,10 +202,11 @@ async function revert() {
}
const _changeCidr = useSubmit(
`/api/admin/interface/cidr`,
{
method: 'post',
},
(data) =>
$fetch(`/api/admin/interface/cidr`, {
method: 'post',
body: data,
}),
{
revert,
successMsg: t('admin.interface.cidrSuccess'),
@@ -216,10 +218,11 @@ async function changeCidr(ipv4Cidr: string, ipv6Cidr: string) {
}
const _restartInterface = useSubmit(
`/api/admin/interface/restart`,
{
method: 'post',
},
(data) =>
$fetch(`/api/admin/interface/restart`, {
method: 'post',
body: data,
}),
{
revert,
successMsg: t('admin.interface.restartSuccess'),