refactor(api): changes to call a helper api to quit and redirect if needed
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
||||||
import axios from "axios";
|
|
||||||
|
import { api } from "../apiHelper";
|
||||||
|
|
||||||
export function getSettings() {
|
export function getSettings() {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
@@ -16,7 +17,7 @@ const fetch = async () => {
|
|||||||
await new Promise((res) => setTimeout(res, 1500));
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await axios.get("/lst/api/settings");
|
const { data } = await api.get("/settings");
|
||||||
|
|
||||||
return data.data;
|
return data.data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
||||||
import axios from "axios";
|
|
||||||
|
import { api } from "../apiHelper";
|
||||||
|
|
||||||
export function notificationSubs(userId?: string) {
|
export function notificationSubs(userId?: string) {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
@@ -16,8 +17,8 @@ const fetch = async (userId?: string) => {
|
|||||||
await new Promise((res) => setTimeout(res, 1500));
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await axios.get(
|
const { data } = await api.get(
|
||||||
`/lst/api/notification/sub${userId ? `?userId=${userId}` : ""}`,
|
`/notification/sub${userId ? `?userId=${userId}` : ""}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return data.data;
|
return data.data;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
||||||
import axios from "axios";
|
|
||||||
|
import { api } from "../apiHelper";
|
||||||
|
|
||||||
export function notifications() {
|
export function notifications() {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
@@ -16,7 +17,7 @@ const fetch = async () => {
|
|||||||
await new Promise((res) => setTimeout(res, 1500));
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await axios.get("/lst/api/notification");
|
const { data } = await api.get("/notification");
|
||||||
|
|
||||||
return data.data;
|
return data.data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
||||||
import axios from "axios";
|
|
||||||
|
import { api } from "../apiHelper";
|
||||||
|
|
||||||
export function servers() {
|
export function servers() {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
@@ -16,7 +17,7 @@ const fetch = async () => {
|
|||||||
await new Promise((res) => setTimeout(res, 1500));
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await axios.get("/lst/api/servers");
|
const { data } = await api.get("/servers");
|
||||||
|
|
||||||
return data.data;
|
return data.data;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user