Fix relative URLs in aethex-social-service.ts
cgen-1d5d8726219d4a3183cdc9cbed489f2f
This commit is contained in:
parent
09989fabbb
commit
a5e4dab0f3
1 changed files with 10 additions and 10 deletions
|
|
@ -81,7 +81,7 @@ export const aethexSocialService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async followUser(followerId: string, followingId: string): Promise<void> {
|
async followUser(followerId: string, followingId: string): Promise<void> {
|
||||||
const resp = await fetch("/api/social/follow", {
|
const resp = await fetch(`${API_BASE}/api/social/follow`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -93,7 +93,7 @@ export const aethexSocialService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async unfollowUser(followerId: string, followingId: string): Promise<void> {
|
async unfollowUser(followerId: string, followingId: string): Promise<void> {
|
||||||
const resp = await fetch("/api/social/unfollow", {
|
const resp = await fetch(`${API_BASE}/api/social/unfollow`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -105,7 +105,7 @@ export const aethexSocialService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async sendInvite(inviterId: string, email: string, message?: string | null) {
|
async sendInvite(inviterId: string, email: string, message?: string | null) {
|
||||||
const resp = await fetch("/api/invites", {
|
const resp = await fetch(`${API_BASE}/api/invites`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -127,14 +127,14 @@ export const aethexSocialService = {
|
||||||
|
|
||||||
async listInvites(inviterId: string) {
|
async listInvites(inviterId: string) {
|
||||||
const resp = await fetch(
|
const resp = await fetch(
|
||||||
`/api/invites?inviter_id=${encodeURIComponent(inviterId)}`,
|
`${API_BASE}/api/invites?inviter_id=${encodeURIComponent(inviterId)}`,
|
||||||
);
|
);
|
||||||
if (!resp.ok) return [];
|
if (!resp.ok) return [];
|
||||||
return await resp.json();
|
return await resp.json();
|
||||||
},
|
},
|
||||||
|
|
||||||
async acceptInvite(token: string, acceptorId: string) {
|
async acceptInvite(token: string, acceptorId: string) {
|
||||||
const resp = await fetch("/api/invites/accept", {
|
const resp = await fetch(`${API_BASE}/api/invites/accept`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ token, acceptor_id: acceptorId }),
|
body: JSON.stringify({ token, acceptor_id: acceptorId }),
|
||||||
|
|
@ -147,7 +147,7 @@ export const aethexSocialService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async applyReward(userId: string, action: string, amount?: number) {
|
async applyReward(userId: string, action: string, amount?: number) {
|
||||||
const resp = await fetch("/api/rewards/apply", {
|
const resp = await fetch(`${API_BASE}/api/rewards/apply`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ user_id: userId, action, amount }),
|
body: JSON.stringify({ user_id: userId, action, amount }),
|
||||||
|
|
@ -179,7 +179,7 @@ export const aethexSocialService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async endorseSkill(endorserId: string, endorsedId: string, skill: string) {
|
async endorseSkill(endorserId: string, endorsedId: string, skill: string) {
|
||||||
const resp = await fetch("/api/social/endorse", {
|
const resp = await fetch(`${API_BASE}/api/social/endorse`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -206,7 +206,7 @@ export const aethexSocialService = {
|
||||||
qs.set("available", String(params.available));
|
qs.set("available", String(params.available));
|
||||||
if (params?.limit) qs.set("limit", String(params.limit));
|
if (params?.limit) qs.set("limit", String(params.limit));
|
||||||
const resp = await fetch(
|
const resp = await fetch(
|
||||||
`/api/mentors${qs.toString() ? `?${qs.toString()}` : ""}`,
|
`${API_BASE}/api/mentors${qs.toString() ? `?${qs.toString()}` : ""}`,
|
||||||
);
|
);
|
||||||
if (!resp.ok) return [] as any[];
|
if (!resp.ok) return [] as any[];
|
||||||
return (await resp.json()) as any[];
|
return (await resp.json()) as any[];
|
||||||
|
|
@ -221,7 +221,7 @@ export const aethexSocialService = {
|
||||||
available?: boolean;
|
available?: boolean;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const resp = await fetch("/api/mentors/apply", {
|
const resp = await fetch(`${API_BASE}/api/mentors/apply`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -243,7 +243,7 @@ export const aethexSocialService = {
|
||||||
mentorId: string,
|
mentorId: string,
|
||||||
message?: string,
|
message?: string,
|
||||||
) {
|
) {
|
||||||
const resp = await fetch("/api/mentorship/request", {
|
const resp = await fetch(`${API_BASE}/api/mentorship/request`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue