Monstarrrr / rebutify

Where activists improve their advocacy by building, refining and using strong rebuttals to counter the objections to their movement.
https://rebutify.org
9 stars 4 forks source link

Create mock routes matching current frontend #293

Closed Monstarrrr closed 1 month ago

Monstarrrr commented 2 months ago

Problem

For initializing the mock API and know if everything works with the front-end, we need to create the currently existing production routes in the Mock API

Current routes:

Solution

Create 'em

*Field errors are sent the following way:

{
  "fieldName1": [ "Error message 1", "Error message 2" ],
  "fieldName2": [ "Error message 1" ]
}

Global errors are sent the following way:

{
  ???
}
Monstarrrr commented 2 months ago

I'm on it

Monstarrrr commented 2 months ago

I have a problem with the authenticator middeware which is that I don't know beforehand if i'm verifying an access or refresh token, but the jwt.verify(token) throws an error if it fails so i'm trying to not make the jwt.verify(accessToken) crash the route if accessToken is invalid so I can try with the refreshToken but I haven't been able to yet.

Update: actually I think it should be handle automatically by the client making a request to refresh the token if accessToken isn't valid anymore so checking for an accessToken only is the normal behaviour