Skip to content

Commit

Permalink
Merge pull request #319 from credebl/fix-dark-mode-issue-api-endpoint…
Browse files Browse the repository at this point in the history
…-change

Fix: dark mode issue api endpoint change
  • Loading branch information
16-karan authored Oct 6, 2023
2 parents 49bb30e + dfb8098 commit 4908d31
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 76 deletions.
68 changes: 64 additions & 4 deletions src/api/ecosystem.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,75 @@
import { axiosGet } from "../services/apiRequests"

import { axiosGet, axiosPost, axiosPut } from "../services/apiRequests"
import { apiRoutes } from "../config/apiRoutes";
import { getFromLocalStorage } from "./Auth";
import { storageKeys } from "../config/CommonConstant";

export const getEcosystem = async () => {
interface DataPayload {
name: string
description: string
logo: string
tags: string
userId: number
}


const url = `${apiRoutes.Ecosystem.root}`
export const createEcosystems = async (dataPayload: DataPayload) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);

const url = `${apiRoutes.Ecosystem.root}/${orgId}`
const payload = dataPayload

const token = await getFromLocalStorage(storageKeys.TOKEN)
const config = {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
}
}
const axiosPayload = {
url,
payload,
config
}

try {
return await axiosPost(axiosPayload);
}
catch (error) {
const err = error as Error
return err?.message
}
}

export const updateEcosystem = async (data: object) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${apiRoutes.Ecosystem.root}/${orgId}`
const payload = data
const token = await getFromLocalStorage(storageKeys.TOKEN)
const config = {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
}
}
const axiosPayload = {
url,
payload,
config
}

try {
return await axiosPut(axiosPayload);
}
catch (error) {
const err = error as Error
return err?.message
}
}

export const getEcosystem = async () => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${apiRoutes.Ecosystem.root}/${orgId}`
const token = await getFromLocalStorage(storageKeys.TOKEN)
const config = {
headers: {
'Content-Type': 'application/json',
Expand Down
70 changes: 0 additions & 70 deletions src/api/ecosystems.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/SideBar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ import { pathRoutes } from '../config/pathRoutes';
</div>

<div
class="fixed inset-0 z-10 hidden bg-gray-900/50 dark:bg-gray-900/90"
class="fixed inset-0 -z-10 hidden bg-gray-900/50 dark:bg-gray-900/90"
id="sidebarBackdrop"
>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CreateEcosystemOrgModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { AxiosResponse } from 'axios';
import { asset } from '../../lib/data.js';
import { createOrganization } from "../../api/organization";
import { getFromLocalStorage } from "../../api/Auth";
import { createEcosystems } from "../../api/ecosystems";
import { createEcosystems } from "../../api/ecosystem";


interface Values {
Expand Down

0 comments on commit 4908d31

Please sign in to comment.