mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 05:37:20 +01:00
Refactored useApi usage.
This commit is contained in:
parent
561cde6e7e
commit
cad0b73e42
26 changed files with 67 additions and 85 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import { useRef } from 'react';
|
||||
import { Form, FormInput, FormButtons, PasswordField, Button } from 'react-basics';
|
||||
import { useApi } from 'next-basics';
|
||||
import useApi from 'hooks/useApi';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { getAuthToken } from 'lib/client';
|
||||
import { getClientAuthToken } from 'lib/client';
|
||||
import styles from './UserPasswordForm.module.css';
|
||||
import useUser from 'hooks/useUser';
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ export default function UserPasswordForm({ onSave, userId }) {
|
|||
|
||||
const isCurrentUser = !userId || id === userId;
|
||||
const url = isCurrentUser ? `/users/${id}/password` : `/users/${id}`;
|
||||
const { post } = useApi(getAuthToken());
|
||||
const { post } = useApi(getClientAuthToken());
|
||||
const { mutate, error, isLoading } = useMutation(data => post(url, data));
|
||||
const ref = useRef(null);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue