Fetches authenticated organization.
1
//native
2
type Motimate = {
3
token: string
4
}
5
6
export async function main(auth: Motimate) {
7
const url = new URL(`https://motimateapp.com/public_api/my_organization`)
8
9
const response = await fetch(url, {
10
method: 'GET',
11
headers: {
12
Authorization: 'Bearer ' + auth.token
13
14
})
15
16
if (!response.ok) {
17
const text = await response.text()
18
throw new Error(`${response.status} ${text}`)
19
20
21
return await response.json()
22
23