11/** Services */
2- import { Server } from "@/services/config"
2+ import { useServerURL } from "@/services/config"
33
44export const fetchNamespaces = async ( { limit, offset, sort } ) => {
55 try {
6- const url = new URL ( `${ Server . API } /namespace` )
6+ const url = new URL ( `${ useServerURL ( ) } /namespace` )
77
88 if ( limit ) url . searchParams . append ( "limit" , limit )
99 if ( offset ) url . searchParams . append ( "offset" , offset )
@@ -18,7 +18,7 @@ export const fetchNamespaces = async ({ limit, offset, sort }) => {
1818
1919export const fetchNamespacesCount = async ( ) => {
2020 try {
21- const url = new URL ( `${ Server . API } /namespace/count` )
21+ const url = new URL ( `${ useServerURL ( ) } /namespace/count` )
2222
2323 const data = await useFetch ( url . href )
2424 return data
@@ -29,7 +29,7 @@ export const fetchNamespacesCount = async () => {
2929
3030export const fetchRecentNamespaces = async ( ) => {
3131 try {
32- const url = new URL ( `${ Server . API } /namespace/active` )
32+ const url = new URL ( `${ useServerURL ( ) } /namespace/active` )
3333
3434 const data = await useFetch ( url . href )
3535 return data
@@ -40,7 +40,7 @@ export const fetchRecentNamespaces = async () => {
4040
4141export const fetchNamespaceByHash = async ( hash ) => {
4242 try {
43- const url = new URL ( `${ Server . API } /namespace_by_hash/${ hash } ` )
43+ const url = new URL ( `${ useServerURL ( ) } /namespace_by_hash/${ hash } ` )
4444
4545 const data = await useFetch ( encodeURI ( url . href ) )
4646 return data
@@ -51,7 +51,7 @@ export const fetchNamespaceByHash = async (hash) => {
5151
5252export const fetchNamespaceMessagesById = async ( { id, version, limit, offset } ) => {
5353 try {
54- const url = new URL ( `${ Server . API } /namespace/${ id } /${ version } /messages` )
54+ const url = new URL ( `${ useServerURL ( ) } /namespace/${ id } /${ version } /messages` )
5555
5656 if ( limit ) url . searchParams . append ( "limit" , limit )
5757 if ( offset ) url . searchParams . append ( "offset" , offset )
@@ -65,7 +65,7 @@ export const fetchNamespaceMessagesById = async ({ id, version, limit, offset })
6565
6666export const fetchNamespaceByMetadata = async ( { hash, height, commitment } ) => {
6767 try {
68- const url = new URL ( `${ Server . API } /namespace_by_hash/${ hash } /${ height } /${ commitment } ` )
68+ const url = new URL ( `${ useServerURL ( ) } /namespace_by_hash/${ hash } /${ height } /${ commitment } ` )
6969
7070 const data = await useFetch ( encodeURI ( url . href ) )
7171 return data
0 commit comments