user dtos as strict object templates
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
// handles user registration, user logins, tokens, password reset, etc.
|
||||
|
||||
import api from "./axios.ts"
|
||||
import type { User } from "../models/User.ts";
|
||||
import type { User, RegisterDto, LoginDto } from "../models/User.ts";
|
||||
|
||||
const API_URL: string = "/auth";
|
||||
|
||||
export const register = async (user: { username: string; email: string; password: string }) => {
|
||||
export const register = async (user: RegisterDto) => {
|
||||
|
||||
try {
|
||||
const response = await api.post(`${API_URL}/register`, user);
|
||||
@@ -24,7 +24,7 @@ export const register = async (user: { username: string; email: string; password
|
||||
|
||||
}
|
||||
|
||||
export const login = async (user: { username: string; password: string }) => {
|
||||
export const login = async (user: LoginDto ) => {
|
||||
|
||||
try {
|
||||
const response = await api.post(`${API_URL}/login`, user);
|
||||
|
||||
Reference in New Issue
Block a user