-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made changes to frontend based on Kashif's feedback
- Loading branch information
1 parent
b336c0f
commit 177a438
Showing
6 changed files
with
29 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const CommandStatusMapping = ["Pending", "Scheduled", "Ongoing", "Cancelled", "Failed", "Completed"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import axios from "axios"; | ||
import { CommandListReponse } from "../data/response"; | ||
import { CommandListResponse } from "../data/response"; | ||
import { API_URL } from "../environment"; | ||
|
||
export const getCommands = async (): Promise<CommandListReponse> => { | ||
export const getCommands = async (): Promise<CommandListResponse> => { | ||
try { | ||
const { data } = await axios.get<CommandListReponse>(`${API_URL}/commands/`) | ||
const { data } = await axios.get<CommandListResponse>(`${API_URL}/commands/`) | ||
return data; | ||
} catch (error) { | ||
console.error(error) | ||
throw error | ||
} | ||
} | ||
|
||
/** | ||
* TODO: (Member) Create a deleteCommand API function based on the following specs. You should be using axios to make the API call | ||
* | ||
* Deletes the command with the given id on the backend and returns the list of commands after its deletion. | ||
* | ||
* @param id: command to delete | ||
* @returns Promise<CommandListResponse>: list of commands after the command with the given id was deleted | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters