Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
halituzan committed Nov 6, 2024
1 parent 4a80520 commit 76c525b
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions app/AdminComponents/About/AboutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const AboutPage = (props: Props) => {

const getAbout = async () => {
try {
const res = await Network.run(null, "GET", "/about/aboutget", null);
const icons = await Network.run(null, "GET", "icons", null);
const res = await Network.run(null, "GET", "/api/about/aboutget", null);
const icons = await Network.run(null, "GET", "/api/icons", null);
setValues(res.data);
setIconList(icons.data ?? []);
} catch (error) {
Expand Down Expand Up @@ -77,7 +77,7 @@ const AboutPage = (props: Props) => {
const res = await Network.run(
null,
!dataOk ? "POST" : "PATCH",
"/about/updateabout",
"/api/about/updateabout",
{
data: values,
method: !dataOk ? "POST" : "PATCH",
Expand Down
8 changes: 4 additions & 4 deletions app/AdminComponents/Blogs/Tiptap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ export default ({ setOpen, current, mount }: any) => {

const getTags = async () => {
try {
const res = await Network.run(null, "GET", "/tags", null);
const res = await Network.run(null, "GET", "/api/tags", null);
setTagList(res.data);
} catch (error) {
console.log(error);
}
};
const createPost = async () => {
try {
await Network.run(null, "POST", "/blogs/create", values);
await Network.run(null, "POST", "/api/blogs/create", values);
setOpen(false);
mount();
} catch (error) {
Expand All @@ -94,7 +94,7 @@ export default ({ setOpen, current, mount }: any) => {
};
const updatePost = async () => {
try {
await Network.run(null, "PATCH", `/blogs/update`, {
await Network.run(null, "PATCH", `/api/blogs/update`, {
...values,
id: current._id,
});
Expand All @@ -106,7 +106,7 @@ export default ({ setOpen, current, mount }: any) => {
};
const deletePost = async () => {
try {
await Network.run(null, "DELETE", `/blogs/delete`, {
await Network.run(null, "DELETE", `/api/blogs/delete`, {
id: current._id,
});
setOpen(false);
Expand Down
2 changes: 1 addition & 1 deletion app/Components/Main/Pages/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const About = ({ data }: Props) => {

const getData = async () => {
try {
const res = await Network.run(null, "GET", "about/aboutget", null);
const res = await Network.run(null, "GET", "/api/about/aboutget", null);
setDatas(res.data);
} catch (error) {
console.log(error);
Expand Down
2 changes: 1 addition & 1 deletion app/Components/Main/Pages/BlogPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const SingleBlogPost = ({ data, code }: Props) => {
await Network.run(
null,
"GET",
"/blogs/interactions/" + endpoint + "?code=" + code,
"/api/blogs/interactions/" + endpoint + "?code=" + code,
null
);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion app/Layout/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const Navbar = (props: Props) => {
const res = await Network.run(
null,
"GET",
`/blogs/search?s=${value}`,
`/api/blogs/search?s=${value}`,
null
);
setSeachList(res.data);
Expand Down
2 changes: 1 addition & 1 deletion pages/about/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default AboutPage;

export async function getServerSideProps(context: any) {
try {
const res = await Network.run(context, "GET", "about/aboutget", null);
const res = await Network.run(context, "GET", "/api/about/aboutget", null);

return {
props: {
Expand Down
2 changes: 1 addition & 1 deletion pages/blogs/[url].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function getServerSideProps(context: any) {
const res = await Network.run(
context,
"GET",
`/blogs/detail?code=${code}`,
`/api/blogs/detail?code=${code}`,
null
);
return {
Expand Down
2 changes: 1 addition & 1 deletion pages/blogs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default BlogsPage;

export async function getServerSideProps(context: any) {
try {
const res = await Network.run(context, "GET", `/blogs`, null);
const res = await Network.run(context, "GET", `/api/blogs`, null);

return {
props: {
Expand Down
2 changes: 1 addition & 1 deletion pages/tags/[tag].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function getServerSideProps(context: any) {
const res = await Network.run(
context,
"GET",
`/blogs/blogtags?tag=${tag}`,
`/api/blogs/blogtags?tag=${tag}`,
null
);
return {
Expand Down
2 changes: 1 addition & 1 deletion utils/Network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const network = class NETWORK {
const baseURL: any =
process.env.NODE_ENV === "production"
? process.env.BASE_URL
: process.env.BASE_URL_DEV;
: "http://localhost:3000";

this.network = axios.create({
baseURL,
Expand Down

0 comments on commit 76c525b

Please sign in to comment.