Skip to content

Commit

Permalink
merge: develop -> master (#91)
Browse files Browse the repository at this point in the history
* refact: created shelter list view component in home page

* Fix: mobile UI has broken for mobile devices (#22)

*Fix: mobile UI has broken for mobile devices

* fix: remove chip as fixed as no wrap property

* chore: add shelter card clickable

* chore: remove Fragment component

* build: add set sm as max mobile dimension
          sm: 425px

* style: add responsive layout

* refactor: filter page

* fix: priority

* fix: filter parameters

* fix: fixed volunteer supply that had been fulfilled displaying on shelter page

* fix: improve readability

* feat: hidden filter button if filter is empty

* feat: cache in axios request

* fix: cache search params

* feat: cache clean on searchs

* fix: donation tags

* fix: clean search params

* fix: donation tags / componentized the urgent supplies section

* fix: removed empty shelter tags empty row

* feat: full edit shelter and improved interface of pet friendly in shelter page

* Fix/develop bugs (#90)

* fix: cache bug (invalite cache on create/update operation)

* feat: added update many shelter supplies and admin rule

* Add license (#81)

Closes #65.

* fix: app port (#80)

---------

Co-authored-by: Luccas Specht <[email protected]>
Co-authored-by: MatheusDubin <[email protected]>
Co-authored-by: Giovanni Bassi <[email protected]>
Co-authored-by: Felipe Monteiro <[email protected]>
  • Loading branch information
5 people authored May 11, 2024
1 parent 4f9a757 commit 3d3f437
Show file tree
Hide file tree
Showing 57 changed files with 1,481 additions and 753 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL=http://localhost:4000
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 SOS-RS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Para executar o frontend do aplicativo em seu ambiente local, siga os passos aba
```
npm run dev
```
O app estará disponível em `http://localhost:3000`.
O app estará disponível em `http://localhost:5173`.

## Contribuindo

Expand Down
178 changes: 178 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"date-fns": "^3.6.0",
"formik": "^2.4.6",
"lucide-react": "^0.378.0",
"qs": "^6.12.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.4",
Expand All @@ -40,6 +41,7 @@
},
"devDependencies": {
"@types/node": "^20.12.8",
"@types/qs": "^6.9.15",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/react-input-mask": "^3.0.5",
Expand Down
21 changes: 18 additions & 3 deletions src/api/api.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
import axios, { AxiosRequestHeaders } from 'axios';
import axios, { AxiosRequestHeaders, InternalAxiosRequestConfig } from 'axios';
import { clearCache, getCacheRequestData, handleCacheResponse } from './cache';

const api = axios.create({
baseURL: import.meta.env.VITE_API_URL ?? 'http://localhost:4000/',
});

api.interceptors.request.use((config) => {
if (!config.headers) config.headers = {} as AxiosRequestHeaders;
function handleRequestAuthToken(config: InternalAxiosRequestConfig<any>) {
const token = localStorage.getItem('token');
if (token) config.headers.Authorization = `Bearer ${token}`;
}

api.interceptors.request.use((config) => {
if (!config.headers) config.headers = {} as AxiosRequestHeaders;
handleRequestAuthToken(config);
const response = getCacheRequestData(config);
if (response) {
config.adapter = () => {
return new Promise((resolve) => {
resolve({ ...response, config });
});
};
}
return config;
});

api.interceptors.response.use(
(config) => {
handleCacheResponse(config);
return config;
},
(error) => {
if (error.response && error.response.status === 401) {
clearCache(false);
localStorage.removeItem('token');
}
return Promise.reject(error);
Expand Down
Loading

0 comments on commit 3d3f437

Please sign in to comment.