update
This commit is contained in:
@ -14,7 +14,7 @@ import { type AuthModel, type UserModel } from '@/auth';
|
||||
import { apiConfig } from '@/config/api.config';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
export const LOGIN_URL = `${API_URL}/login`;
|
||||
export const FORGOT_PASSWORD_URL = `${API_URL}/reset_password`;
|
||||
@ -28,7 +28,7 @@ interface AuthContextProps {
|
||||
saveAuth: (auth: AuthModel | undefined) => void;
|
||||
currentUser: UserModel | undefined;
|
||||
setCurrentUser: Dispatch<SetStateAction<UserModel | undefined>>;
|
||||
login: (email: string, password: string, application: string) => Promise<void>;
|
||||
login: (email: string, password: string) => Promise<void>;
|
||||
requestPasswordResetLink: (email: string) => Promise<void>;
|
||||
changePassword: (token: string, password: string, password_confirmation: string) => Promise<void>;
|
||||
getUser: () => Promise<AxiosResponse<any> | {}>;
|
||||
@ -70,13 +70,12 @@ const AuthProvider = ({ children }: PropsWithChildren) => {
|
||||
}
|
||||
};
|
||||
|
||||
const login = async (username: string, password: string, application: string) => {
|
||||
const login = async (username: string, password: string) => {
|
||||
try {
|
||||
const { data: auth } = await axios
|
||||
.post(LOGIN_URL, { username, password, application })
|
||||
.post(LOGIN_URL, { username, password })
|
||||
.then((response) => response.data);
|
||||
|
||||
// console.log('auth :', auth);
|
||||
saveAuth({ ...auth.token, id: auth.user.id, role_name: auth.role_name, user: auth.user });
|
||||
setCurrentUser(auth.user);
|
||||
const createActivity = {
|
||||
|
||||
Reference in New Issue
Block a user