redesign user data api
This commit is contained in:
parent
f132049948
commit
44361e614d
17 changed files with 80 additions and 52 deletions
|
|
@ -16,7 +16,7 @@ export const useApiStore = defineStore("api", () => {
|
|||
*
|
||||
* @example
|
||||
* // Fetch data for the current page
|
||||
* fetchPageData().then(data => {
|
||||
* fetchData().then(data => {
|
||||
* console.log(data);
|
||||
* }).catch(error => {
|
||||
* console.error('Error fetching data:', error);
|
||||
|
|
@ -24,13 +24,13 @@ export const useApiStore = defineStore("api", () => {
|
|||
*
|
||||
* @example
|
||||
* // Fetch data for a specific path
|
||||
* fetchPageData('/about').then(data => {
|
||||
* fetchData('/about').then(data => {
|
||||
* console.log(data);
|
||||
* }).catch(error => {
|
||||
* console.error('Error fetching data:', error);
|
||||
* });
|
||||
*/
|
||||
async function fetchPageData(path = window.location.pathname) {
|
||||
async function fetchData(path = window.location.pathname) {
|
||||
const isHomePage = path === "/";
|
||||
path = path === "/" ? "/home" : path;
|
||||
path = path.startsWith("/") ? path : "/" + path;
|
||||
|
|
@ -120,5 +120,5 @@ export const useApiStore = defineStore("api", () => {
|
|||
}
|
||||
}
|
||||
|
||||
return { fetchDataThroughKQL, fetchPageData, fetchRoute };
|
||||
return { fetchDataThroughKQL, fetchData, fetchRoute };
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue