Skip to content

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stanlemon committed Feb 29, 2024
1 parent c700397 commit aefdcd8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 5 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dotenv from "dotenv";
import createSession from "./createSession.js";
import { createAppServer, SimpleUsersDao } from "@stanlemon/server-with-auth";
import { createAppServer, LowDBUserDao, createLowDb } from "@stanlemon/server-with-auth";
import Joi from "joi";

dotenv.config();
Expand All @@ -14,18 +14,19 @@ const schema = Joi.object({
password: Joi.string().required().min(8).max(64).label("Password"),
});

const dao = new SimpleUsersDao();
const db = createLowDb();
const dao = new LowDBUserDao(db);

const app = createAppServer({
port,
webpack: "http://localhost:8080",
secure: ["/api/"],
schema,
...dao,
dao,
});

app.get("/api/session", async (req, res, next) => {
const user = await dao.getUserById(req.user);
const user = await dao.getUserByUsername(req.user.username);

const session = await createSession(
process.env.TWILIO_ACCOUNT_SID,
Expand Down
5 changes: 4 additions & 1 deletion src/views/ConversationView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export default function ConversationView({
try {
await addParticipant(conversation, address, proxyAddress);
} catch (e) {
console.error(e);

Check warning on line 72 in src/views/ConversationView.tsx

View workflow job for this annotation

GitHub Actions / test

Unexpected console statement

const err = e as ServerError;
toaster.push({
message: err.body.message,
Expand Down Expand Up @@ -101,9 +103,10 @@ export default function ConversationView({
label="Add a Participant"
onAdd={(address) =>
// TODO: The user should be able to select the proxy address from the list
// TODO: Provide a helpful error when there are no phone numbers
onAddParticipant(
address,
session?.phoneNumbers[0].phoneNumber || ""
session?.phoneNumbers[0]?.phoneNumber || ""
)
}
button={
Expand Down
2 changes: 1 addition & 1 deletion src/views/RegisterView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function RegisterView() {

const onSubmit = () => {
setErrors({});
fetch("/auth/register", {
fetch("/auth/signup", {
headers: {
Accept: "application/json",
"Content-Type": "application/json",
Expand Down

0 comments on commit aefdcd8

Please sign in to comment.