anything-llm/frontend/src/models/invite.js
Timothy Carambat f48e6b1a3e
chore: add @ as alias for frontend root (#414)
* chore: add @ as alias for frontend root

* fix: remove bad tag
2023-12-07 09:09:01 -08:00

28 lines
704 B
JavaScript

import { API_BASE } from "@/utils/constants";
const Invite = {
checkInvite: async (inviteCode) => {
return await fetch(`${API_BASE}/invite/${inviteCode}`, {
method: "GET",
})
.then((res) => res.json())
.catch((e) => {
console.error(e);
return { invite: null, error: e.message };
});
},
acceptInvite: async (inviteCode, newUserInfo = {}) => {
return await fetch(`${API_BASE}/invite/${inviteCode}`, {
method: "POST",
body: JSON.stringify(newUserInfo),
})
.then((res) => res.json())
.catch((e) => {
console.error(e);
return { success: false, error: e.message };
});
},
};
export default Invite;