Skip to content

Commit

Permalink
feat: Added user type in api call
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-merlin committed Feb 14, 2024
1 parent 3d04965 commit f1c5537
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/api/lib/users.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type AxiosResponse } from 'axios'
import request from '../apiClient'
import type { User } from '../../types/index'

export const getAllUsers = async (): Promise<AxiosResponse> => {
return await request('GET', '/v1/users/all')
Expand All @@ -9,11 +10,11 @@ export const getUser = async (username: string): Promise<AxiosResponse> => {
return await request('GET', `/v1/users/user?username=${username}`)
}

export const addUser = async (user: unknown): Promise<AxiosResponse> => {
export const addUser = async (user: User): Promise<AxiosResponse> => {
return await request('POST', '/v1/users/user', JSON.stringify(user))
}

export const updateUser = async (username: string, user: unknown): Promise<AxiosResponse> => {
export const updateUser = async (username: string, user: User): Promise<AxiosResponse> => {
return await request('PUT', `/v1/users/user?username=${username}`, JSON.stringify(user))
}

Expand Down

0 comments on commit f1c5537

Please sign in to comment.