mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
adding location to ranges and more control on MyCalendarRanges
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import {fetchResults} from "./apiMethods";
|
||||
import {Location, LocationType} from "../../types";
|
||||
|
||||
export const getLocations = (): Promise<Location[]> => fetchResults('/api/1.0/main/location.json');
|
||||
|
||||
export const getLocationTypes = (): Promise<LocationType[]> => fetchResults('/api/1.0/main/location-type.json');
|
25
src/Bundle/ChillMainBundle/Resources/public/lib/api/user.ts
Normal file
25
src/Bundle/ChillMainBundle/Resources/public/lib/api/user.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {User} from "../../types";
|
||||
import {makeFetch} from "./apiMethods";
|
||||
|
||||
export const whoami = (): Promise<User> => {
|
||||
const url = `/api/1.0/main/whoami.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
throw {
|
||||
msg: 'Error while getting whoami.',
|
||||
sta: response.status,
|
||||
txt: response.statusText,
|
||||
err: new Error(),
|
||||
body: response.body
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
export const whereami = (): Promise<Location | null> => {
|
||||
const url = `/api/1.0/main/user-current-location.json`;
|
||||
|
||||
return makeFetch<null, Location|null>("GET", url);
|
||||
}
|
Reference in New Issue
Block a user