From 0baa57e23396fa620d37afc510f5a7a260f1ae1d Mon Sep 17 00:00:00 2001 From: Rezaul Karim Shaon Date: Mon, 2 Dec 2024 01:30:38 +0600 Subject: [PATCH] done: #131 - api calling service renamed --- frontend/src/services/v1/userAPIService.js | 8 ++++---- frontend/src/store/modules/users/authentication.js | 4 ++-- frontend/src/store/modules/users/profile.js | 8 ++++---- frontend/src/store/modules/users/register.js | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/frontend/src/services/v1/userAPIService.js b/frontend/src/services/v1/userAPIService.js index fb59b39..46eed6c 100644 --- a/frontend/src/services/v1/userAPIService.js +++ b/frontend/src/services/v1/userAPIService.js @@ -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) @@ -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) @@ -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 }) @@ -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 }) diff --git a/frontend/src/store/modules/users/authentication.js b/frontend/src/store/modules/users/authentication.js index d792910..04a8a34 100644 --- a/frontend/src/store/modules/users/authentication.js +++ b/frontend/src/store/modules/users/authentication.js @@ -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 @@ -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) { diff --git a/frontend/src/store/modules/users/profile.js b/frontend/src/store/modules/users/profile.js index 1100946..d4d2aa8 100644 --- a/frontend/src/store/modules/users/profile.js +++ b/frontend/src/store/modules/users/profile.js @@ -1,8 +1,8 @@ // src/store/modules/users/profile.js import { - getUserProfile, - editUserProfile + getV1UserProfile, + editV1UserProfile } from '@/services/v1/userAPIService' export default { @@ -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) @@ -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) { diff --git a/frontend/src/store/modules/users/register.js b/frontend/src/store/modules/users/register.js index 97bb870..6d741ea 100644 --- a/frontend/src/store/modules/users/register.js +++ b/frontend/src/store/modules/users/register.js @@ -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: { @@ -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)