Source: api/user.js

import { Config } from "../config.js"
import { getUserToken } from "./auth.js"
import { http } from "../utils/http/index.js"

/**
 * @export
 * EventBus.
 * @module User
 * This is an experimental API.
 *
 *
 */

/**
 *
 * @async
 * @returns {object}
 */
export async function getUserInfo() {
	let headers = {
		"Content-Type": "application/json",
		Accept: "application/json",
		"x-jibb-user-jwt": await getUserToken(),
	}

	let response = await http.get(`${Config.apiBaseURL}/v1/users/me`, headers)
	return response.data
}

/**
 * @async
 * @param {number} orgId
 * @returns - http result
 */
export async function activateUser(orgId) {
	let headers = {
		"Content-Type": "application/json",
		Accept: "application/json",
		"x-jibb-user-jwt": await getUserToken(),
	}

	let body = {
		organizationId: orgId,
	}
	return http.post(`${Config.apiBaseURL}/v1/users/activate`, body, headers)
}