Skip to content

Commit

Permalink
Update AuthenticationService.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
plduthoit authored Oct 8, 2024
1 parent bc18de4 commit 7804839
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions vue/src/services/auth/AuthenticationService.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import type { SignInValues, SignUpValues } from "@/models/interfaces/auth/AuthenticationsValues";
import type { User } from "@/models/interfaces/auth/User";
import axios, { type AxiosResponse } from "axios";
import { apiClient } from '@/assets/plugins/axios'
import type { AxiosResponse } from "axios";


export class AuthenticationService {
static async signIn(values: SignInValues): Promise<AxiosResponse> {
return axios.post('https://puc.local/auth', JSON.stringify(values), {
return apiClient.post('/auth', JSON.stringify(values), {
headers: { 'Content-Type': 'application/json' }
})
}

static async signUp(values: SignUpValues): Promise<AxiosResponse> {
return axios.post('https://puc.local/api/users', JSON.stringify(values), { headers: { 'Content-Type': 'application/ld+json' } })
return apiClient.post('/api/users', JSON.stringify(values), { headers: { 'Content-Type': 'application/ld+json' } })
}

static async getAuthenticatedUser(): Promise<AxiosResponse<User>> {
return axios.get('https://puc.local/api/users/me', { headers: {'accept': 'application/ld+json'}})
return apiClient.get('/api/users/me', { headers: {'accept': 'application/ld+json'}})
}

static async patchUser(values: Partial<User>, userID: number): Promise<AxiosResponse> {
return axios.patch(`https://puc.local/api/users/${userID}`, JSON.stringify(values), { headers: { 'Content-Type': 'application/merge-patch+json' } })
return apiClient.patch(`/api/users/${userID}`, JSON.stringify(values), { headers: { 'Content-Type': 'application/merge-patch+json' } })
}
}
}

0 comments on commit 7804839

Please sign in to comment.