Updates to match API changes.

This commit is contained in:
Ada Werefox 2025-04-30 14:17:52 -07:00
parent 112acbc9d2
commit a74ac00b55
7 changed files with 23 additions and 32 deletions

View file

@ -1,14 +1,15 @@
export const authorization = {
message: false,
}
export function isLoggedIn(): Promise<boolean> {
return fetch('http://localhost:31337/user/authorized', {
return fetch('http://192.168.50.91:31337/user/authorized', {
credentials: 'include',
})
.then((res) => {
return res.json().then((res_json) => {
const is_authorized = res_json.message
return Boolean(is_authorized)
return res_json.message
})
})
.catch(() => {
return false
})
.catch(() => {})
}

View file

@ -9,7 +9,7 @@ export const function_tags_store = reactive({
})
export function update_function_tags() {
fetch('http://localhost:31337/all/function-tags', {
fetch('http://192.168.50.91:31337/all/function-tags', {
credentials: 'include',
})
.then((res) => {
@ -24,9 +24,9 @@ export function update_function_tags() {
}
export function add_function_tag(function_tag_name: string) {
const post_url = new URL('http://localhost:31337/function-tag')
const post_url = new URL('http://192.168.50.91:31337/function-tag')
const search_params = new URLSearchParams()
search_params.append('name', function_tag_name)
search_params.append('id', function_tag_name)
post_url.search = search_params.toString()
fetch(post_url, {
credentials: 'include',
@ -34,9 +34,6 @@ export function add_function_tag(function_tag_name: string) {
body: JSON.stringify({
name: function_tag_name,
}),
headers: {
'Content-Type': 'application/json',
},
})
.then((res) => {
if (res.status === 400) {

View file

@ -23,7 +23,7 @@ export const functions_store = reactive({
})
export function get_functions() {
fetch('http://localhost:31337/all/functions', {
fetch('http://192.168.50.91:31337/all/functions', {
credentials: 'include',
})
.then((res) => {
@ -43,9 +43,9 @@ export function update_function(
function_tags: string[],
function_requirements: string[],
) {
const post_url = new URL('http://localhost:31337/function')
const post_url = new URL('http://192.168.50.91:31337/function')
const search_params = new URLSearchParams()
search_params.append('name', function_name)
search_params.append('id', function_name)
function_tags.forEach((tag) => {
search_params.append('tags', tag)
})
@ -63,9 +63,6 @@ export function update_function(
tags: function_tags,
requirements: function_requirements,
}),
headers: {
'Content-Type': 'application/json',
},
})
.then((res) => {
if (res.status === 400) {
@ -80,9 +77,9 @@ export function update_function(
}
export function delete_function(function_name: string) {
const delete_url = new URL('http://localhost:31337/function')
const delete_url = new URL('http://192.168.50.91:31337/function')
const search_params = new URLSearchParams()
search_params.append('name', function_name)
search_params.append('id', function_name)
delete_url.search = search_params.toString()
fetch(delete_url, {
credentials: 'include',
@ -108,9 +105,9 @@ export function add_function(
function_tags: string[],
function_requirements: string[],
) {
const post_url = new URL('http://localhost:31337/function')
const post_url = new URL('http://192.168.50.91:31337/function')
const search_params = new URLSearchParams()
search_params.append('name', function_name)
search_params.append('id', function_name)
function_tags.forEach((tag) => {
search_params.append('tags', tag)
})
@ -128,9 +125,6 @@ export function add_function(
tags: function_tags,
requirements: function_requirements,
}),
headers: {
'Content-Type': 'application/json',
},
})
.then((res) => {
if (res.status === 400) {

View file

@ -9,7 +9,7 @@ export const groups_store = reactive({
})
export function update_groups() {
fetch('http://localhost:31337/all/groups', {
fetch('http://192.168.50.91:31337/all/groups', {
credentials: 'include',
})
.then((res) => {
@ -24,13 +24,10 @@ export function update_groups() {
}
export function add_group(group: string) {
fetch('http://localhost:31337/group?name=' + group, {
fetch('http://192.168.50.91:31337/group?name=' + group, {
credentials: 'include',
method: 'POST',
body: JSON.stringify({ name: group }),
headers: {
'Content-Type': 'application/json',
},
})
.then((res) => {
if (res.status === 400) {

View file

@ -9,7 +9,7 @@ export const user_store = reactive({
})
export function update_info() {
fetch('http://localhost:31337/user/info', {
fetch('http://192.168.50.91:31337/user/info', {
credentials: 'include',
})
.then((res) => {

View file

@ -118,7 +118,7 @@ onMounted(update_function_tags)
</div>
<a
class="flex w-full p-2 font-mono text-lg md:p-4 md:text-2xl bg-secondary ring-2 ring-secondary/80 h-fit0 hover:bg-secondary/50"
href="http://localhost:31337/auth/logout"
href="http://192.168.50.91:31337/auth/logout"
>
<div class="w-full h-full text-center bg-primary">
<p class="drop-shadow-accent drop-shadow-md">Logout</p>

View file

@ -6,6 +6,8 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
import vueDevTools from 'vite-plugin-vue-devtools'
import tailwindcss from '@tailwindcss/vite'
export const api_domain = 'http://192.168.50.91:31337'
// https://vite.dev/config/
export default defineConfig({
server: {