Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

[PROD] Next Release #32

Merged
merged 12 commits into from
Aug 16, 2021
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Make sure you have [Heroky CLI](https://devcenter.heroku.com/articles/heroku-cli
This app exports functions to be imported by other microapps.

- `login` - redirects to login page
- `businessLogin` - redirects to business (i.e. customer) login page
- `logout` - clears session storage and redirects to logout page
- `setAppMenu` - sets sidebar menu for the app by app's `path`
- `getAuthUserTokens` - returns a promise which resolves to object with user tokens `{ tokenV3, tokenV2 }`
Expand Down Expand Up @@ -95,6 +96,7 @@ For example see https://github.com/topcoder-platform/micro-frontends-react-app
```js
module.exports = {
login: () => {},
businessLogin: () => {},
logout: () => {},
setAppMenu: () => {},
getAuthUserTokens: () => new Promise(() => {}),
Expand All @@ -121,6 +123,7 @@ For example see https://github.com/topcoder-platform/micro-frontends-angular-app
```js
declare module '@topcoder/micro-frontends-navbar-app' {
export const login: any;
export const businessLogin: any;
export const logout: any;
export const setAppMenu: any;
export const getAuthUserTokens: any;
Expand Down
1 change: 1 addition & 0 deletions config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
TC_NOTIFICATION_URL: "https://api.topcoder-dev.com/v5/notifications",
CONNECT_DOMAIN: "https://connect.topcoder-dev.com",
COMMUNITY_DOMAIN: "https://www.topcoder-dev.com",
TAAS_APP: "https://platform.topcoder-dev.com/taas/myteams",
},
API: {
V3: "https://api.topcoder-dev.com/v3",
Expand Down
1 change: 1 addition & 0 deletions config/prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
TC_NOTIFICATION_URL: "https://api.topcoder.com/v5/notifications",
CONNECT_DOMAIN: "https://connect.topcoder.com",
COMMUNITY_DOMAIN: "https://www.topcoder.com",
TAAS_APP: "https://platform.topcoder.com/taas/myteams",
},
API: {
V3: "https://api.topcoder.com/v3",
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
transformIgnorePatterns: ["node_modules/?!(tc-auth-lib)"],
moduleNameMapper: {
"\\.(css|scss)$": "identity-obj-proxy",
"\\.svg$": "<rootDir>/__mocks__/fileMock.js",
"\\.(png|eot|otf|ttf|woff|woff2|svg)$": "<rootDir>/__mocks__/fileMock.js",
},
setupFilesAfterEnv: [
"../node_modules/@testing-library/jest-dom/dist/index.js",
Expand Down
148 changes: 61 additions & 87 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* global process */
const express = require('express');
const express = require("express");

const app = express();

app.use(
"/navbar",
express.static("./dist", {
setHeaders: function setHeaders(res) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET');
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET");
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept'
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept"
);
},
})
Expand Down
25 changes: 19 additions & 6 deletions src/actions/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
NOTIFICATIONS_PENDING,
SET_NOTIFICATION_PLATFORM,
RESET_NOTIFICATIONS,
RESET_COMMUNITY_NOTIFICATIONS,
} from "../constants/notifications";
import notificationsService from "../services/notifications";
import {
Expand Down Expand Up @@ -83,6 +82,25 @@ export const getNotifications = () => (dispatch) => {
});
};

export const getTaaSNotifications = () => (dispatch) => {
dispatch({ type: GET_NOTIFICATIONS_PENDING });
notificationsService
.getTaaSNotifications()
.then((notifications) => {
dispatch({
type: GET_NOTIFICATIONS_SUCCESS,
payload: notifications,
});
})
.catch((err) => {
dispatch({
type: GET_NOTIFICATIONS_FAILURE,
payload: err,
});
console.error(`Failed to load notifications. ${err.message}`);
});
};

export const getCommunityNotifications = () => (dispatch) => {
dispatch({ type: GET_COMMUNITY_NOTIFICATIONS_PENDING });
notificationsService
Expand Down Expand Up @@ -243,10 +261,6 @@ export const resetNotifications = () => (dispatch) => {
dispatch({ type: RESET_NOTIFICATIONS });
};

export const resetCommunityNotifications = () => (dispatch) => {
dispatch({ type: RESET_COMMUNITY_NOTIFICATIONS });
};

export default {
getNotifications,
getCommunityNotifications,
Expand All @@ -262,5 +276,4 @@ export default {
markNotificationsRead,
setNotificationPlatform,
resetNotifications,
resetCommunityNotifications,
};
Loading