Skip to content
Open
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
39 changes: 39 additions & 0 deletions src/api/emails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { AxiosPromise } from 'axios';
import API from './api';
import APIResponse from './APIResponse';
import axios from 'axios';

class EmailsAPI {
constructor() {
API.createEntity('email');
}

/**
* Trigger automated status emails endpoint
* POST /api/email/automated/status/:status
*/
public sendAutomatedStatus(
status: string
): AxiosPromise<APIResponse<{ success: number; failed: number }>> {
return API.getEndpoint('email').create(undefined, {
subURL: `automated/status/${status}`,
config: { withCredentials: true },
});
}

/**
* Get count of hackers with specified status
* GET /api/email/automated/status/:status/count
*/
public getStatusCount(
status: string
): AxiosPromise<APIResponse<{ count: number }>> {
const baseURL = API.getEndpoint('email')['resourceURL'];
return axios.get(`${baseURL}/automated/status/${status}/count`, {
withCredentials: true,
});
}
}

export const Emails = new EmailsAPI();
export default Emails;
1 change: 1 addition & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './travel';
export * from './search';
export * from './settings';
export * from './sponsor';
export * from './emails';
2 changes: 1 addition & 1 deletion src/features/Dashboard/StaffDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AdminDashboardContainer extends React.Component<{}, IDashboardState> {

public render() {
return (
<DashboardView cards={this.generateCards()} title={'Staff Dashboard'} />
<DashboardView cards={this.generateCards()} title={'Staff Dashboard'} />
);
}

Expand Down
Loading