Skip to content

Commit

Permalink
done: #131 - api calling service renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
rkshaon committed Dec 1, 2024
1 parent ed18c6b commit 0baa57e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions frontend/src/services/v1/userAPIService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const content = 'user'
const version = 'v1'

// Register user
export const registerUser = async (userData) => {
export const registerV1User = async (userData) => {
const URL = `${API_BASE_URL}/${content}/${version}/registration`
try {
const response = await api.post(URL, userData)
Expand All @@ -18,7 +18,7 @@ export const registerUser = async (userData) => {
}

// Login user
export const loginUser = async (credentials) => {
export const loginV1User = async (credentials) => {
try {
const URL = `${API_BASE_URL}/${content}/${version}/login`
const response = await api.post(URL, credentials)
Expand All @@ -29,7 +29,7 @@ export const loginUser = async (credentials) => {
}

// Get user profile
export const getUserProfile = async () => {
export const getV1UserProfile = async () => {
try {
const URL = `${API_BASE_URL}/${content}/${version}/profile`
const response = await api.get(URL, { requiresAuth: true })
Expand All @@ -40,7 +40,7 @@ export const getUserProfile = async () => {
}

// Edit user profile
export const editUserProfile = async (userData) => {
export const editV1UserProfile = async (userData) => {
try {
const URL = `${API_BASE_URL}/${content}/${version}/profile`
const response = await api.put(URL, userData, { requiresAuth: true })
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/modules/users/authentication.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/store/modules/users/authentication.js

import { loginUser } from '@/services/v1/userAPIService'
import { loginV1User } from '@/services/v1/userAPIService'
import {
getAccessToken, getRefreshToken, setAccessToken, setRefreshToken,
removeAccessToken, removeRefreshToken
Expand Down Expand Up @@ -49,7 +49,7 @@ export default {
console.log(getRefreshToken())
commit('SET_LOADING', true)
try {
const response = await loginUser(credentials)
const response = await loginV1User(credentials)
commit('SET_TOKEN', response)
commit('SET_ERROR', null)
} catch (error) {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/store/modules/users/profile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// src/store/modules/users/profile.js

import {
getUserProfile,
editUserProfile
getV1UserProfile,
editV1UserProfile
} from '@/services/v1/userAPIService'

export default {
Expand Down Expand Up @@ -41,7 +41,7 @@ export default {
async fetchUserProfile ({ commit }) {
commit('SET_LOADING', true)
try {
const response = await getUserProfile()
const response = await getV1UserProfile()
commit('SET_USER', response)
} catch (error) {
console.log(error)
Expand All @@ -52,7 +52,7 @@ export default {
async editUserProfile ({ commit }, userData) {
commit('SET_LOADING', true)
try {
const response = await editUserProfile(userData)
const response = await editV1UserProfile(userData)
commit('SET_USER', response)
commit('SET_EDIT_SUCCESS_MESSAGE', 'Profile updated successfully')
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/modules/users/register.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/store/modules/users/register.js

import { registerUser } from '@/services/v1/userAPIService'
import { registerV1User } from '@/services/v1/userAPIService'

export default {
state: {
Expand Down Expand Up @@ -28,7 +28,7 @@ export default {
async register ({ commit }, userData) {
commit('SET_LOADING', true)
try {
const response = await registerUser(userData)
const response = await registerV1User(userData)
console.log(response)
console.log(response.data)
commit('SET_SUCCESS_MESSAGE', response.message)
Expand Down

0 comments on commit 0baa57e

Please sign in to comment.