Skip to content

Commit

Permalink
Merge pull request #525 from bluewave-labs/add-allowed-hosts
Browse files Browse the repository at this point in the history
Last changes before 1.0.0
  • Loading branch information
erenfn authored Jan 28, 2025
2 parents 91fac05 + 4ad8e51 commit e3cf460
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ NODE_ENV - node environment (production, test or development)

It is set from the .env file in the root directory

2. Api Url
2. Backend Url

```
API_BASE_URL - Backend API url
BASE_URL - Backend url
```

It is set from ./frontend/src/utils/constant.js
Expand Down
2 changes: 1 addition & 1 deletion backend/src/controllers/team.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const setOrganisation = async (req, res) => {
return res.status(400).json({ error: 'Cannot create more than one team.' });
}

const newOrg = await teamService.createTeam(name);
const newOrg = await teamService.createTeamWithAgentUrl(name);
return res.status(201).json({
status: 201,
message: 'Organization created successfully',
Expand Down
15 changes: 14 additions & 1 deletion backend/src/service/team.service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { where } = require("sequelize");
const settings = require("../../config/settings");
const db = require("../models");
const Team = db.Team;
Expand All @@ -21,6 +20,20 @@ class TeamService {
}
}

async createTeamWithAgentUrl(name) {
const transaction = await sequelize.transaction();
const agentUrl = 'https://cdn.jsdelivr.net/gh/bluewave-labs/[email protected]/jsAgent/'
try {
const team = await Team.create({ name, agentUrl }, { transaction });
await transaction.commit();
return team;
} catch (err) {
await transaction.rollback();
throw new Error("Failed to create team");
}
}


async getTeam() {
try {
const team = await Team.findOne({
Expand Down
4 changes: 2 additions & 2 deletions frontend/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Guidefox</title>
<link rel="icon" type="image/svg+xml" href="/svg/favicon.svg" />
<script type="module" crossorigin src="/assets/index-4Qqfvg46.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B2RrmTqS.css">
<script type="module" crossorigin src="/assets/index-BJhRV-7j.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-ZKMHXvUn.css">
</head>

<body>
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import GoogleIconSvg from '../../../assets/google-icon.svg';
import GoogleIconSvg from '../../../assets/icons/google-icon.svg';
import './GoogleSignInButton.css';

const GoogleSignInButton = ({ text='Sign in with Google', onClick = () => {}}) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { IconButton, useTheme } from '@mui/material';
import { DuplicateIcon, EditIcon, TrashIcon } from '../../../../../../public/svg/utilityIcons';
import { DuplicateIcon, EditIcon, TrashIcon } from '../../../../../assets/icons/utilityIcons';
import CircleIcon from '@mui/icons-material/Circle';
import './ListItem.css';
import { useAuth } from '../../../../../services/authProvider';
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/utils/constants.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// API constants
//local environment
export const API_BASE_URL = 'http://localhost:3000/api/';
export const BASE_URL = 'localhost:3000';
export const API_BASE_URL = `http://${BASE_URL}/api/`;

//staging environment
// export const API_BASE_URL = 'https://onboarding-demo.bluewavelabs.ca/api/';
// export const BASE_URL = 'onboarding-demo.bluewavelabs.ca';
// export const API_BASE_URL = `https://${BASE_URL}/api/`;
// Other constants
export const APP_TITLE = 'Bluewave Onboarding';
export const SUPPORT_EMAIL = '[email protected]';
Expand Down
4 changes: 3 additions & 1 deletion frontend/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import { BASE_URL } from './src/utils/constants';

export default defineConfig({
base: '/',
plugins: [react()],
server: {
host: '0.0.0.0',
port: 4173
port: 4173,
allowedHosts: [BASE_URL]
},
css: {
preprocessorOptions: {
Expand Down

0 comments on commit e3cf460

Please sign in to comment.