-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #736 from aziontech/dev
DEPLOY 2024.02.16
- Loading branch information
Showing
26 changed files
with
488 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/services/auth-services/make-password-setting-service-base-url.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const makePasswordSettingServiceBaseUrl = () => { | ||
const version = 'v4' | ||
return `${version}/iam/user/password` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { AxiosHttpClientAdapter } from '@/services/axios/AxiosHttpClientAdapter' | ||
import * as Errors from '@/services/axios/errors' | ||
import { makePasswordSettingServiceBaseUrl } from './make-password-setting-service-base-url' | ||
|
||
export const passwordSettingService = async (payload) => { | ||
let httpResponse = await AxiosHttpClientAdapter.request({ | ||
url: makePasswordSettingServiceBaseUrl(), | ||
method: 'POST', | ||
body: payload | ||
}) | ||
return parseHttpResponse(httpResponse) | ||
} | ||
|
||
/** | ||
* @param {Object} httpResponse - The HTTP response object. | ||
* @param {Object} httpResponse.body - The response body. | ||
* @param {String} httpResponse.statusCode - The HTTP status code. | ||
* @returns {Object} The result message based on the status code. | ||
* @throws {Error} If there is an error with the response. | ||
*/ | ||
|
||
const parseHttpResponse = (httpResponse) => { | ||
switch (httpResponse.statusCode) { | ||
case 200: | ||
return httpResponse.body | ||
case 400: | ||
throw new Error(extractApiError(httpResponse.body, 'non_field_errors')).message | ||
case 403: | ||
throw new Errors.PermissionError().message | ||
case 404: | ||
throw new Error(extractApiError(httpResponse.body, 'detail')).message | ||
case 500: | ||
throw new Errors.InternalServerError().message | ||
default: | ||
throw new Errors.UnexpectedError().message | ||
} | ||
} | ||
|
||
/** | ||
* @param {Object} errorSchema - The error schema. | ||
* @param {string} key - The error key of error schema. | ||
* @returns {string} The result message based on the status code. | ||
*/ | ||
const extractApiError = (errorSchema, key) => { | ||
const errorMessage = errorSchema[key] || 'Unexpected error.' | ||
|
||
if (errorMessage === 'Not found.') { | ||
return 'Token not found.' | ||
} | ||
|
||
return errorMessage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<FeedbackFish :projectId="projectId" /> | ||
|
||
<PrimeButton | ||
:label="currentLabel" | ||
data-feedback-fish | ||
:data-feedback-fish-userid="user.email" | ||
:pt="{ | ||
label: { class: 'text-white' }, | ||
icon: { class: 'text-white' } | ||
}" | ||
icon="pi pi-flag" | ||
size="small" | ||
class="text-white border-header bg-header hover:bg-header-button-hover" | ||
v-tooltip.bottom="{ value: 'Feedback', showDelay: 200 }" | ||
/> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, inject } from 'vue' | ||
import { FeedbackFish } from '@feedback-fish/vue' | ||
import { useAccountStore } from '@/stores/account' | ||
import PrimeButton from 'primevue/button' | ||
const projectId = '2566aa41e7e334' | ||
const SCREEN_BREAKPOINT_MD = 768 | ||
const currentWidth = inject('currentWidth') | ||
const user = useAccountStore().accountData | ||
const currentLabel = computed(() => { | ||
if (currentWidth.value > SCREEN_BREAKPOINT_MD) { | ||
return 'Feedback' | ||
} | ||
return '' | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.