use camelCase

This commit is contained in:
bastantoine 2022-12-22 20:13:04 +01:00
parent ee7ebe4a6c
commit b1e681914f
4 changed files with 11 additions and 11 deletions

View file

@ -16,7 +16,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import { InfoCircle } from '@vicons/tabler';
import { get_claim_label } from './jwt-parser.service';
import { getClaimLabel } from './jwt-parser.service';
const props = defineProps({
claim: {
@ -25,5 +25,5 @@ const props = defineProps({
},
});
const label = computed(() => get_claim_label(props.claim ? props.claim : ''));
const label = computed(() => getClaimLabel(props.claim ? props.claim : ''));
</script>

View file

@ -5,10 +5,10 @@ interface JWT {
payload: Map<string, unknown>;
}
export function safe_jwt_decode(raw_jwt: string): JWT {
export function safeJwtDecode(rawJwt: string): JWT {
try {
const header = jwt_decode(raw_jwt, { header: true }) as Map<string, unknown>;
const payload = jwt_decode(raw_jwt) as Map<string, unknown>;
const header = jwt_decode(rawJwt, { header: true }) as Map<string, unknown>;
const payload = jwt_decode(rawJwt) as Map<string, unknown>;
return { header, payload };
} catch (e) {
if (e instanceof InvalidTokenError) {
@ -19,7 +19,7 @@ export function safe_jwt_decode(raw_jwt: string): JWT {
}
}
export function get_claim_label(claim: string): { label: string; ref: string } {
export function getClaimLabel(claim: string): { label: string; ref: string } {
const infos = STANDARD_CLAIMS.find((info) => info.name === claim);
if (infos) {
return { label: infos.long_name, ref: infos.ref };
@ -33,7 +33,7 @@ export function get_claim_label(claim: string): { label: string; ref: string } {
return { label: claim, ref: '' };
}
export function parse_claim_value(claim: string, value: unknown): { value: unknown; extension?: unknown } {
export function parseClaimValue(claim: string, value: unknown): { value: unknown; extension?: unknown } {
switch (claim) {
case 'exp':
case 'nbf':

View file

@ -35,7 +35,7 @@ import { computed, ref } from 'vue';
import jwt_decode from 'jwt-decode';
import { useValidation } from '@/composable/validation';
import { isNotThrowing } from '@/utils/boolean';
import { safe_jwt_decode } from './jwt-parser.service';
import { safeJwtDecode } from './jwt-parser.service';
import claimVue from './claim.vue';
import valueVue from './value.vue';
@ -45,7 +45,7 @@ const raw_jwt = ref(
const showParsedValues = ref(true);
const decodedJWT = computed(() => {
return safe_jwt_decode(raw_jwt.value);
return safeJwtDecode(raw_jwt.value);
});
const validation = useValidation({
source: raw_jwt,

View file

@ -7,7 +7,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import { parse_claim_value } from './jwt-parser.service';
import { parseClaimValue } from './jwt-parser.service';
const props = defineProps({
claim: {
@ -20,5 +20,5 @@ const props = defineProps({
},
});
const value = computed(() => parse_claim_value(props.claim, props.value));
const value = computed(() => parseClaimValue(props.claim, props.value));
</script>