chamesu
Version:
This package contains all packages of the chat application.
43 lines (31 loc) • 1.21 kB
text/typescript
/*
* Copyright (c) 2022.
* Author Peter Placzek (tada5hi)
* For the full copyright and license information,
* view the LICENSE file that was distributed with this source code.
*/
import {formatRequestRecord, RequestRecord} from "~/modules/api/utils";
import {useApi} from "~/modules/api";
export async function getContact(contactId: string) {
const response = await useApi('auth')
.get('/auth/contacts/' + contactId);
return response.data;
}
export async function getContacts(record?: RequestRecord) {
const {data: response} = await useApi('auth')
.get('/auth/contacts' + formatRequestRecord(record));
return response;
}
export async function dropContact(contactId: string) {
const {data: response} = await useApi('auth')
.delete('/auth/contacts/'+contactId);
return response;
}
export async function editContact(contactId: string, data: {[key: string] : any}) {
const { data: response } = await useApi('auth').post('auth/contacts/'+contactId, data);
return response;
}
export async function addContact(data: {[key: string] : any}) {
const { data: response } = await useApi('auth').post('auth/contacts', data);
return response;
}