Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/pages/manage/metas/AddOrEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const AddOrEdit = () => {
}

const t = useT()
const { params, back } = useRouter()
const { params, to } = useRouter()
const { id } = params
const [meta, setMeta] = createStore<Meta>({
id: 0,
Expand All @@ -143,12 +143,12 @@ const AddOrEdit = () => {
header: "",
header_sub: false,
})
const [metaLoading, loadMeta] = useFetch((): PResp<Meta> =>
r.get(`/admin/meta/get?id=${id}`),
const [metaLoading, loadMeta] = useFetch(
(): PResp<Meta> => r.get(`/admin/meta/get?id=${id}`),
)
const [users, setUsers] = createSignal<User[]>([])
const [getUsersLoading, getUsers] = useFetch((): PPageResp<User> =>
r.get("/admin/user/list"),
const [getUsersLoading, getUsers] = useFetch(
(): PPageResp<User> => r.get("/admin/user/list"),
)

const initEdit = async () => {
Expand Down Expand Up @@ -238,7 +238,7 @@ const AddOrEdit = () => {
// TODO maybe can use handleRrespWithNotifySuccess
handleResp(resp, () => {
notify.success(t("global.save_success"))
back()
to("/@manage/metas", false, { replace: true })
})
}}
>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/manage/shares/AddOrEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { me } from "~/store"

const AddOrEdit = () => {
const t = useT()
const { params, back, to } = useRouter()
const { params, to } = useRouter()
const { id } = params
const [shareLoading, loadShare] = useFetch(
(): PResp<ShareInfo> => r.get(`/share/get?id=${id}`),
Expand Down Expand Up @@ -192,7 +192,7 @@ const AddOrEdit = () => {
resp,
() => {
notify.success(t("global.save_success"))
back()
to("/@manage/shares", false, { replace: true })
},
(_msg, _code) => {
if (resp.data.id) {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/manage/storages/AddOrEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Drivers = Record<string, DriverInfo>

const AddOrEdit = () => {
const t = useT()
const { params, back, to } = useRouter()
const { params, to } = useRouter()
const { id } = params
const [driversLoading, loadDrivers] = useFetch(
(): PResp<Drivers> => r.get("/admin/driver/list"),
Expand Down Expand Up @@ -209,7 +209,7 @@ const AddOrEdit = () => {
resp,
() => {
notify.success(t("global.save_success"))
back()
to("/@manage/storages", false, { replace: true })
},
(msg, code) => {
if (resp.data.id) {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/manage/users/AddOrEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Permission = (props: {

const AddOrEdit = () => {
const t = useT()
const { params, back } = useRouter()
const { params, to } = useRouter()
const { id } = params
const [user, setUser] = createStore<User>({
id: 0,
Expand All @@ -58,8 +58,8 @@ const AddOrEdit = () => {
sso_id: "",
allow_ldap: false,
})
const [userLoading, loadUser] = useFetch((): PResp<User> =>
r.get(`/admin/user/get?id=${id}`),
const [userLoading, loadUser] = useFetch(
(): PResp<User> => r.get(`/admin/user/get?id=${id}`),
)

const initEdit = async () => {
Expand Down Expand Up @@ -169,7 +169,7 @@ const AddOrEdit = () => {
notify.success(t("global.save_success"))
if (user.username === me().username)
handleResp(await (r.get("/me") as PResp<Me>), setMe)
back()
to("/@manage/users", false, { replace: true })
})
}}
>
Expand Down