Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: dark mode issue api endpoint change #319

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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