Skip to content

Commit 03c9527

Browse files
committed
Merge branch 'sudo'
2 parents b6c0581 + 7c763a3 commit 03c9527

File tree

20 files changed

+570
-64
lines changed

20 files changed

+570
-64
lines changed

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

package-lock.json

Lines changed: 29 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"eslint-config-prettier": "^9.0.0",
1313
"react": "^18.2.0",
1414
"react-dom": "^18.2.0",
15+
"react-hot-toast": "^2.4.1",
1516
"react-query": "^3.39.3",
1617
"react-redux": "^8.1.3",
1718
"react-router-dom": "^6.16.0",
@@ -71,6 +72,6 @@
7172
"husky": "^8.0.3",
7273
"prettier": "^3.0.3",
7374
"sass": "^1.68.0",
74-
"typescript": "^5.2.2"
75+
"typescript": "^4.9.5"
7576
}
7677
}

src/app/api/file.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
import axios from 'axios';
1+
import axios, { AxiosResponse } from 'axios';
22
import { BACKEND_URL } from 'envConstants';
33

4+
5+
export interface FileUpload{
6+
7+
message: string,
8+
isSuccessful: boolean,
9+
statusCode: number,
10+
11+
}
12+
13+
14+
15+
416
export const uploadIcon = async (
517
authorizationToken: string,
618
orgName: string,
719
file: File
8-
) => {
20+
):Promise<AxiosResponse<FileUpload>> => {
921
const url = BACKEND_URL + '/api/protected/file/upload/' + orgName;
1022
const formData = new FormData();
1123
formData.append('file', file);
12-
const respnse = await axios.post(url, formData, {
24+
const respnse = await axios.post<FileUpload>(url, formData, {
1325
headers: {
1426
Accept: 'application/json',
1527
Authorization: `Bearer ${authorizationToken}`,

src/app/api/organization.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
import axios from 'axios';
1+
import axios, { AxiosResponse } from 'axios';
22
import { BACKEND_URL } from 'envConstants';
33

44
export interface organizationBody {
55
name: string;
66
description: string;
77
}
88

9+
10+
export interface AllOrgs{
11+
organizations: {
12+
id: number,
13+
name: string,
14+
description: string|null
15+
}[]
16+
}
17+
18+
19+
20+
921
export const deleteOrg = async (
1022
authorizationToken: string,
1123
orgName: string
@@ -195,9 +207,9 @@ export const getOrg = async (authorizationToken: string, orgName: string) => {
195207
return respnse;
196208
};
197209

198-
export const getAllOrgs = async (authorizationToken: string) => {
210+
export const getAllOrgs = async (authorizationToken: string): Promise<AxiosResponse<AllOrgs>> => {
199211
const url = BACKEND_URL + '/api/protected/org/getAllOrg';
200-
const respnse = await axios.get(url, {
212+
const respnse = await axios.get<AllOrgs>(url, {
201213
headers: {
202214
Accept: 'application/json',
203215
Authorization: `Bearer ${authorizationToken}`,

src/app/api/user.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ export interface UserData{
99
}
1010

1111

12+
13+
export interface AllUserData{
14+
users: {
15+
id: number,
16+
username: string
17+
}[]
18+
}
19+
1220
export const getUser= async (authorizationToken: string):Promise<AxiosResponse<UserData>> => {
1321
const url = BACKEND_URL + '/api/protected/user/getUser';
1422

@@ -24,9 +32,9 @@ export const getUser= async (authorizationToken: string):Promise<AxiosResponse<U
2432

2533
};
2634

27-
export const getAllUser = async (authorizationToken: string) => {
35+
export const getAllUser = async (authorizationToken: string):Promise<AxiosResponse<AllUserData>> => {
2836
const url = BACKEND_URL + '/api/protected/user/all';
29-
const respnse = await axios.get(url, {
37+
const respnse = await axios.get<AllUserData>(url, {
3038
headers: {
3139
Accept: 'application/json',
3240
Authorization: `Bearer ${authorizationToken}`,

src/app/assets/images/github.png

778 Bytes
Loading

src/app/assets/images/login2.png

865 KB
Loading

src/app/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import React from 'react';
22
import Navbar from 'app/components/navbar';
33
import BasicRoutes from 'app/routes/BasicRoutes';
44
import './index.scss';
5-
5+
import { Toaster } from 'react-hot-toast';
66
function App() {
77
return (
88
<>
99
<Navbar />
1010
<BasicRoutes />
11+
<Toaster/>
1112
</>
1213
);
1314
}

src/app/routes/BasicRoutes.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import AddProject from 'features/AddProject';
66
import Error from 'features/Error';
77
import WorkspaceView from 'features/workspace-view';
88
import Login from 'features/login';
9+
import AddWorkspace from 'features/AddWorkspace';
910
const BasicRoutes = () => {
1011
return (
1112
<Routes>
@@ -14,6 +15,7 @@ const BasicRoutes = () => {
1415
<Route path={'/addproject'} element={<AddProject />} />
1516
<Route path={'/workspace-view'} element={<WorkspaceView />} />
1617
<Route path={'/login'} element={<Login />} />
18+
<Route path={'/addWorkspace'} element={<AddWorkspace />} />
1719
<Route path={'/*'} element={<Error />} />
1820
</Routes>
1921
);

0 commit comments

Comments
 (0)