♻️ Refactor urls with aliased services
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
|
||||
<div v-if="post.body?.thumbnail" class="mb-5">
|
||||
<v-img
|
||||
:src="`${config.public.solarNetworkApi}/cgi/files/attachments/${post.body?.thumbnail}`"
|
||||
:src="`${config.public.solarNetworkApi}/cgi/uc/attachments/${post.body?.thumbnail}`"
|
||||
:aspect-ratio="16 / 9"
|
||||
alt="Post thumbnail"
|
||||
class="rounded-md"
|
||||
|
@ -33,7 +33,7 @@ async function loadPost({ done }: any) {
|
||||
searchQueries.set("category", props.category)
|
||||
}
|
||||
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?` + searchQueries)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts?` + searchQueries)
|
||||
const result = await res.json()
|
||||
|
||||
if (result.data.length > 0) {
|
||||
|
@ -19,7 +19,7 @@ async function loadPost({ done }: any) {
|
||||
offset: posts.value.length.toString(),
|
||||
})
|
||||
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts/${props.postId}/replies?` + searchQueries)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts/${props.postId}/replies?` + searchQueries)
|
||||
const result = await res.json()
|
||||
|
||||
if (result.data.length > 0) {
|
||||
|
@ -46,7 +46,7 @@ const nickname = computed(() => {
|
||||
}
|
||||
})
|
||||
const avatar = computed(() => {
|
||||
return id.userinfo?.avatar ? `${config.public.solarNetworkApi}/cgi/files/attachments/${id.userinfo?.avatar}` : void 0
|
||||
return id.userinfo?.avatar ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${id.userinfo?.avatar}` : void 0
|
||||
})
|
||||
|
||||
function signOut() {
|
||||
|
@ -126,7 +126,7 @@ async function readTickets({ page, itemsPerPage }: { page?: number; itemsPerPage
|
||||
|
||||
reverting.sessions = true
|
||||
const res = await solarFetch(
|
||||
"/cgi/auth/users/me/tickets?" +
|
||||
"/cgi/id/users/me/tickets?" +
|
||||
new URLSearchParams({
|
||||
take: pagination.tickets.pageSize.toString(),
|
||||
offset: ((pagination.tickets.page - 1) * pagination.tickets.pageSize).toString(),
|
||||
@ -148,7 +148,7 @@ async function readEvents({ page, itemsPerPage }: { page?: number; itemsPerPage?
|
||||
|
||||
reverting.events = true
|
||||
const res = await solarFetch(
|
||||
"/cgi/auth/users/me/events?" +
|
||||
"/cgi/id/users/me/events?" +
|
||||
new URLSearchParams({
|
||||
take: pagination.events.pageSize.toString(),
|
||||
offset: ((pagination.events.page - 1) * pagination.events.pageSize).toString(),
|
||||
@ -168,7 +168,7 @@ Promise.all([readTickets({}), readEvents({})])
|
||||
|
||||
async function killTicket(item: any) {
|
||||
reverting.sessions = true
|
||||
const res = await solarFetch(`/cgi/auth/users/me/tickets/${item.id}`, {
|
||||
const res = await solarFetch(`/cgi/id/users/me/tickets/${item.id}`, {
|
||||
method: "DELETE",
|
||||
})
|
||||
if (res.status !== 200) {
|
||||
|
@ -21,7 +21,7 @@ const loading = ref(false)
|
||||
async function load() {
|
||||
loading.value = true
|
||||
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?take=5&realmId=${config.public.solarRealmId}`)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts?take=5&realmId=${config.public.solarRealmId}`)
|
||||
const result = await res.json()
|
||||
|
||||
items.value.push(...result.data)
|
||||
|
@ -24,7 +24,7 @@ const emits = defineEmits(["update:metadata"])
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const { data } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/files/attachments?take=${props.attachments.length}&id=${props.attachments.join(",")}`)
|
||||
const { data } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/uc/attachments?take=${props.attachments.length}&id=${props.attachments.join(",")}`)
|
||||
const metadata = computed(() => data.value.data)
|
||||
|
||||
watch(metadata, (value) => {
|
||||
@ -32,6 +32,6 @@ watch(metadata, (value) => {
|
||||
}, { deep: true, immediate: true })
|
||||
|
||||
function getAttachmentUrl(id: number) {
|
||||
return `${config.public.solarNetworkApi}/cgi/files/attachments/${id}`
|
||||
return `${config.public.solarNetworkApi}/cgi/uc/attachments/${id}`
|
||||
}
|
||||
</script>
|
||||
|
@ -56,6 +56,6 @@ const item = computed(() => props.item)
|
||||
const showMature = ref(false)
|
||||
|
||||
function getAttachmentUrl(id: number) {
|
||||
return `${config.public.solarNetworkApi}/cgi/files/attachments/${id}`
|
||||
return `${config.public.solarNetworkApi}/cgi/uc/attachments/${id}`
|
||||
}
|
||||
</script>
|
||||
|
@ -47,7 +47,7 @@ async function submit() {
|
||||
if (!probe.value || !password.value) return
|
||||
|
||||
emits("update:loading", true)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth`, {
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username: probe.value, password: password.value }),
|
||||
|
@ -36,7 +36,7 @@ async function load() {
|
||||
onMounted(() => load())
|
||||
|
||||
async function getToken(tk: string) {
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/token`, {
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/token`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
|
@ -58,7 +58,7 @@ const emits = defineEmits(["swap", "update:ticket", "update:loading"])
|
||||
|
||||
async function submit() {
|
||||
emits("update:loading", true)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/mfa`, {
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/mfa`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
|
@ -44,7 +44,7 @@ const emits = defineEmits(["swap", "update:loading", "update:currentFactor"])
|
||||
|
||||
async function load() {
|
||||
emits("update:loading", true)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/factors?ticketId=${props.ticket.id}`)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/factors?ticketId=${props.ticket.id}`)
|
||||
if (res.status !== 200) {
|
||||
error.value = await res.text()
|
||||
} else {
|
||||
@ -59,7 +59,7 @@ async function submit() {
|
||||
if (!focus.value) return
|
||||
|
||||
emits("update:loading", true)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/factors/${focus.value}`, {
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/factors/${focus.value}`, {
|
||||
method: "POST",
|
||||
})
|
||||
if (res.status !== 200 && res.status !== 204) {
|
||||
|
@ -14,7 +14,7 @@ const { t } = useI18n()
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const { status, data: post } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/interactive/posts/${props.id}`)
|
||||
const { status, data: post } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/co/posts/${props.id}`)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
Reference in New Issue
Block a user