mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-10-21 02:44:23 +00:00
feat: clients (#272)
* feat: clients * fix typo * fix reivew comments * add error message if account miss realm or device calling app * fix: remove Showed By
This commit is contained in:
1 parent
96ffce8cd1
commit
0dd9548600
14 files changed
+529
-2
No files matched your search
@@ -278,3 +278,4 @@ export const API_LCRS = `${API_BASE_URL}/Lcrs`;
|
||||
export const API_LCR_ROUTES = `${API_BASE_URL}/LcrRoutes`;
|
||||
export const API_LCR_CARRIER_SET_ENTRIES = `${API_BASE_URL}/LcrCarrierSetEntries`;
|
||||
export const API_TTS_CACHE = `${API_BASE_URL}/TtsCache`;
|
||||
export const API_CLIENTS = `${API_BASE_URL}/Clients`;
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
API_LCR_CARRIER_SET_ENTRIES,
|
||||
API_LCRS,
|
||||
API_TTS_CACHE,
|
||||
API_CLIENTS,
|
||||
} from "./constants";
|
||||
import { ROUTE_LOGIN } from "src/router/routes";
|
||||
import {
|
||||
@@ -72,6 +73,7 @@ import type {
|
||||
LcrCarrierSetEntry,
|
||||
BucketCredential,
|
||||
BucketCredentialTestResult,
|
||||
Client,
|
||||
} from "./types";
|
||||
import { StatusCodes } from "./types";
|
||||
import { JaegerRoot } from "./jaeger-types";
|
||||
@@ -407,6 +409,10 @@ export const postLcrCarrierSetEntry = (
|
||||
payload
|
||||
);
|
||||
};
|
||||
|
||||
export const postClient = (payload: Partial<Client>) => {
|
||||
return postFetch<SidResponse, Partial<Client>>(API_CLIENTS, payload);
|
||||
};
|
||||
/** Named wrappers for `putFetch` */
|
||||
|
||||
export const putUser = (sid: string, payload: Partial<UserUpdatePayload>) => {
|
||||
@@ -520,6 +526,12 @@ export const putLcrCarrierSetEntries = (
|
||||
);
|
||||
};
|
||||
|
||||
export const putClient = (sid: string, payload: Partial<Client>) => {
|
||||
return putFetch<EmptyResponse, Partial<Client>>(
|
||||
`${API_CLIENTS}/${sid}`,
|
||||
payload
|
||||
);
|
||||
};
|
||||
/** Named wrappers for `deleteFetch` */
|
||||
|
||||
export const deleteUser = (sid: string) => {
|
||||
@@ -599,6 +611,9 @@ export const deleteAccountTtsCache = (sid: string) => {
|
||||
return deleteFetch<EmptyResponse>(`${API_BASE_URL}/Accounts/${sid}/TtsCache`);
|
||||
};
|
||||
|
||||
export const deleteClient = (sid: string) => {
|
||||
return deleteFetch<EmptyResponse>(`${API_CLIENTS}/${sid}`);
|
||||
};
|
||||
/** Named wrappers for `getFetch` */
|
||||
|
||||
export const getUser = (sid: string) => {
|
||||
@@ -637,6 +652,14 @@ export const getLcrCarrierSetEtries = (sid: string) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const getClients = () => {
|
||||
return getFetch<Client[]>(API_CLIENTS);
|
||||
};
|
||||
|
||||
export const getClient = (sid: string) => {
|
||||
return getFetch<Client[]>(`${API_CLIENTS}/${sid}`);
|
||||
};
|
||||
|
||||
/** Wrappers for APIs that can have a mock dev server response */
|
||||
|
||||
export const getRecentCalls = (sid: string, query: Partial<CallQuery>) => {
|
||||
|
||||
@@ -453,6 +453,14 @@ export interface LcrCarrierSetEntry {
|
||||
priority: number;
|
||||
}
|
||||
|
||||
export interface Client {
|
||||
client_sid?: null | string;
|
||||
account_sid: null | string;
|
||||
username: null | string;
|
||||
password?: null | string;
|
||||
is_active: boolean;
|
||||
}
|
||||
|
||||
export interface PageQuery {
|
||||
page: number;
|
||||
count: number;
|
||||
|
||||
Reference in new issue
Block a user