rework review comments

This commit is contained in:
Claus-Peter Huebner 2024-04-11 00:40:38 +02:00
parent 569a89ce2d
commit e44da4d6a3
5 changed files with 14 additions and 13 deletions

View File

@ -9,10 +9,11 @@ import { LogError } from '@/server/LogError'
import { backendLogger as logger } from '@/server/logger'
import { GmsUser } from './model/GmsUser'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
/*
export async function communityList(): Promise<GmsCommunity[] | string | undefined> {
const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/')
const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_URL)
const service = 'community/list?page=1&perPage=20'
const config = {
headers: {
@ -44,7 +45,7 @@ export async function communityList(): Promise<GmsCommunity[] | string | undefin
}
export async function userList(): Promise<GmsUser[] | string | undefined> {
const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/')
const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_URL)
const service = 'community-user/list?page=1&perPage=20'
const config = {
headers: {
@ -80,7 +81,7 @@ export async function userList(): Promise<GmsUser[] | string | undefined> {
}
export async function userByUuid(uuid: string): Promise<GmsUser[] | string | undefined> {
const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/')
const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_URL)
const service = 'community-user/list?page=1&perPage=20'
const config = {
headers: {
@ -118,9 +119,7 @@ export async function userByUuid(uuid: string): Promise<GmsUser[] | string | und
export async function createGmsUser(apiKey: string, user: GmsUser): Promise<boolean> {
if (CONFIG.GMS_ACTIVE) {
const baseUrl = CONFIG.GMS_API_URL.endsWith('/')
? CONFIG.GMS_API_URL
: CONFIG.GMS_API_URL.concat('/')
const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_API_URL)
const service = 'community-user'
const config = {
headers: {
@ -154,9 +153,7 @@ export async function createGmsUser(apiKey: string, user: GmsUser): Promise<bool
export async function updateGmsUser(apiKey: string, user: GmsUser): Promise<boolean> {
if (CONFIG.GMS_ACTIVE) {
const baseUrl = CONFIG.GMS_API_URL.endsWith('/')
? CONFIG.GMS_API_URL
: CONFIG.GMS_API_URL.concat('/')
const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_API_URL)
const service = 'community-user'
const config = {
headers: {
@ -193,9 +190,7 @@ export async function verifyAuthToken(
communityUuid: string,
token: string,
): Promise<string> {
const baseUrl = CONFIG.GMS_API_URL.endsWith('/')
? CONFIG.GMS_API_URL
: CONFIG.GMS_API_URL.concat('/')
const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_API_URL)
const service = 'verify-auth-token?token='.concat(token).concat('&uuid=').concat(communityUuid)
const config = {
headers: {

View File

@ -29,3 +29,7 @@ export function resetInterface<T extends Record<string, any>>(obj: T): T {
}
return obj
}
export const ensureUrlEndsWithSlash = (url: string): string => {
return url.endsWith('/') ? url : url.concat('/')
}

View File

@ -125,3 +125,5 @@ GMS_ACTIVE=false
#GMS_API_URL=http://54.176.169.179:3071
GMS_API_URL=http://localhost:4044/
GMS_DASHBOARD_URL=http://localhost:8080/
GMS_WEBHOOK_SECRET=secret
GMS_CREATE_USER_THROW_ERRORS=false

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -33,7 +33,7 @@
<span class="ml-2">{{ $t('navigation.info') }}</span>
</b-nav-item>
<b-nav-item to="/usersearch" active-class="activeRoute">
<b-img src="/img/svg/loupe.png" height="20" class="svg-icon" />
<b-img src="/img/loupe.png" height="20" />
<span class="ml-2">{{ $t('navigation.usersearch') }}</span>
</b-nav-item>
</b-nav>