Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downgrade Web-API to http #189

Merged
merged 3 commits into from
Jun 11, 2022
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
2 changes: 1 addition & 1 deletion reviews-website/Controllers/ReviewsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task<IActionResult> Create(String comment, String username, int rat
int id;
try
{
id = _context.Review.Max(r => r.Id) + 1;
id = _context.Review == null ? 1 : _context.Review.Max(r => r.Id) + 1;
}
catch (Exception)
{
Expand Down
2 changes: 1 addition & 1 deletion reviews-website/Views/Reviews/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</div>
<div class="invitation">
<div class="center">
Come and see the app yourself, <a href='https://localhost:3000/' target="_blank">here</a>!
Come and see the app yourself, <a href='http://localhost:3000/' target="_blank">here</a>!
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions web-api/Controllers/ContactsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ private void _initExampleChatsAndUsers()
var drake = _usersService.Get("drake6942");
var ch1 = _chatsService.Get("user123-Crisr7");
var ch2 = _chatsService.Get("user123-drake6942");
if (cris == null || drake == null || ch1 == null || ch2 == null)
{
return;
}

ch1.Members.Add(user1);
ch1.Members.Add(cris);
ch2.Members.Add(user1);
Expand Down
2 changes: 1 addition & 1 deletion web-api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:54321;http://localhost:5295",
"applicationUrl": "http://localhost:54321;http://localhost:5295",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
6 changes: 3 additions & 3 deletions web-client/src/components/Auth/SignIn/SignInForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "./SignInForm.css";
import "../auth.css";

const getMessages = async (chatID, token) => {
const response = await fetch("https://localhost:54321/api/contacts/" + chatID + "/messages", {
const response = await fetch("http://localhost:54321/api/contacts/" + chatID + "/messages", {
method: "GET",
headers: {
"Authorization": "Bearer " + token,
Expand All @@ -14,7 +14,7 @@ const getMessages = async (chatID, token) => {
return await response.json();
}
const getContacts = async (token) => {
const response = await fetch("https://localhost:54321/api/contacts", {
const response = await fetch("http://localhost:54321/api/contacts", {
method: "GET",
headers: {
"Authorization": "Bearer " + token,
Expand All @@ -24,7 +24,7 @@ const getContacts = async (token) => {
return await response.json();
}
const signIn = async (username, password, setToken) => {
const response = await fetch("https://localhost:54321/api/contacts/signin", {
const response = await fetch("http://localhost:54321/api/contacts/signin", {
method: "POST",
headers: {
"Content-Type": "application/json"
Expand Down
2 changes: 1 addition & 1 deletion web-client/src/components/Auth/SignUp/SignUpForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const SignUpForm = ({user, setUser, setToken}) => {
"name": displayName,
};
// Sign up user
const response = await fetch("https://localhost:54321/api/contacts/signup", {
const response = await fetch("http://localhost:54321/api/contacts/signup", {
method: "POST", headers: {
"Content-Type": "application/json"
}, body: JSON.stringify(newUser)
Expand Down
2 changes: 1 addition & 1 deletion web-client/src/components/ChatPage/ChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ChatPage = ({user, setUser, token, theme, setTheme}) => {

useEffect(() => {
const connect = new HubConnectionBuilder()
.withUrl("https://localhost:54321/messageHub")
.withUrl("http://localhost:54321/messageHub")
.build();

setConnection(connect);
Expand Down
2 changes: 1 addition & 1 deletion web-client/src/components/ChatPage/ChatSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ChatSection = ({user, setUser, currentChatID, messagesCache, setMessagesCa
});

// Send message to the server
await fetch("https://localhost:54321/api/contacts/" + currentChatID + "/messages", {
await fetch("http://localhost:54321/api/contacts/" + currentChatID + "/messages", {
method: "POST", headers: {
"Authorization": "Bearer " + user.token, "Content-Type": "application/json"
}, body: JSON.stringify({content: message.content})
Expand Down
2 changes: 1 addition & 1 deletion web-client/src/components/ChatPage/ContactsSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const ContactsSection = ({
};

// Search for user in database
const contactUser = await fetch('https://localhost:54321/api/contacts', {
const contactUser = await fetch('http://localhost:54321/api/contacts', {
method: "POST", headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + token,
Expand Down