mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 12:21:07 +03:30
Edit forgot password
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ const ApiService = {
|
||||
},
|
||||
async (error) => {
|
||||
if (error.request.status == 401) {
|
||||
if (error.config.url.includes('/o/token/')) {
|
||||
if (error.config.url.includes('/auth/login/')) {
|
||||
// Refresh token has failed. Logout the user
|
||||
store.dispatch('auth/logout')
|
||||
throw error
|
||||
|
||||
+28
@@ -48,6 +48,34 @@ const UserService = {
|
||||
throw new AuthenticationError(error.response.status, error.response.data.detail);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Login the user and store the access token to TokenService.
|
||||
*
|
||||
* @returns access_token
|
||||
* @throws AuthenticationError
|
||||
**/
|
||||
forgotPassword: async function(cell_number) {
|
||||
const requestData = {
|
||||
method: 'post',
|
||||
url: "/forgotPassword",
|
||||
data: {
|
||||
cell_number,
|
||||
},
|
||||
auth: {
|
||||
username: process.env.VUE_APP_CLIENT_ID,
|
||||
password: process.env.VUE_APP_CLIENT_SECRET
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await ApiService.customRequest(requestData);
|
||||
ApiService.setHeader();
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw new AuthenticationError(error.response.status, error.response.data.detail);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh the access token.
|
||||
|
||||
Reference in New Issue
Block a user