Did a whole ton of stuff, notably cloudflare tunnel hosting
This commit is contained in:
@@ -69,11 +69,11 @@ export enum Status {
|
||||
Accepted = "Accepted",
|
||||
Denied = "Denied",
|
||||
}
|
||||
|
||||
const addr = "localhost:3000"
|
||||
// @ts-ignore
|
||||
const addr = import.meta.env.VITE_APIHOST;
|
||||
|
||||
export async function loadApplication(id: number | string): Promise<ApplicationFull | null> {
|
||||
const res = await fetch(`http://${addr}/application/${id}`)
|
||||
const res = await fetch(`${addr}/application/${id}`)
|
||||
if (res.status === 204) return null
|
||||
if (!res.ok) throw new Error('Failed to load application')
|
||||
const json = await res.json()
|
||||
@@ -86,7 +86,7 @@ export async function postApplication(val: any) {
|
||||
let out = {
|
||||
"App": val,
|
||||
}
|
||||
const res = await fetch(`http://${addr}/application`, {
|
||||
const res = await fetch(`${addr}/application`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(out),
|
||||
@@ -100,7 +100,7 @@ export async function postChatMessage(message: any, post_id: number) {
|
||||
message: message
|
||||
}
|
||||
|
||||
const response = await fetch(`http://${addr}/application/${post_id}/comment`, {
|
||||
const response = await fetch(`${addr}/application/${post_id}/comment`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(out),
|
||||
@@ -110,7 +110,7 @@ export async function postChatMessage(message: any, post_id: number) {
|
||||
}
|
||||
|
||||
export async function getAllApplications() {
|
||||
const res = await fetch(`http://${addr}/application/all`)
|
||||
const res = await fetch(`${addr}/application/all`)
|
||||
|
||||
if (res.ok) {
|
||||
return res.json()
|
||||
@@ -120,7 +120,7 @@ export async function getAllApplications() {
|
||||
}
|
||||
|
||||
export async function approveApplication(id: Number) {
|
||||
const res = await fetch(`http://${addr}/application/approve/${id}`, { method: 'POST' })
|
||||
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST' })
|
||||
|
||||
if (!res.ok) {
|
||||
console.error("Something went wrong approving the application")
|
||||
@@ -128,9 +128,9 @@ export async function approveApplication(id: Number) {
|
||||
}
|
||||
|
||||
export async function denyApplication(id: Number) {
|
||||
const res = await fetch(`http://${addr}/application/deny/${id}`, { method: 'POST' })
|
||||
const res = await fetch(`${addr}/application/deny/${id}`, { method: 'POST' })
|
||||
|
||||
if (!res.ok) {
|
||||
console.error("Something went wrong approving the application")
|
||||
console.error("Something went wrong denying the application")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user