sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
| // Easy Frontend | |
| // Học FE đơn giản, dễ hiểu và đặc biệt phải vui ❤️ | |
| // JS NÂNG CAO - Xử lý expired token trong Javascript như thế nào? | |
| // ❓ Chuyện gì xảy ra nếu giữa chừng token bị expired? | |
| // Ví dụ: 3 api requests đồng thời với nhau | |
| // TRƯỜNG HỢP 1: Token chưa expired, vẫn còn tốt chán 🤣 | |
| // --request 1--> |
| type ResponseWithData = Response & { data?: any }; | |
| interface Fetcher { | |
| run(input: RequestInfo, init?: RequestInit): Promise<ResponseWithData>; | |
| } | |
| class BasicFetcher implements Fetcher { | |
| async run(input: RequestInfo, init?: RequestInit): Promise<ResponseWithData> { | |
| return await fetch(input, init); | |
| } |
Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.
Copy (replace) only the attached files to their respective directories. app/Exceptions/Handler.php and app/Http/Middleware/Authenticate.php
| <?php | |
| // This can be found in the Symfony\Component\HttpFoundation\Response class | |
| const HTTP_CONTINUE = 100; | |
| const HTTP_SWITCHING_PROTOCOLS = 101; | |
| const HTTP_PROCESSING = 102; // RFC2518 | |
| const HTTP_OK = 200; | |
| const HTTP_CREATED = 201; | |
| const HTTP_ACCEPTED = 202; |
| {"lastUpload":"2021-04-20T03:59:20.871Z","extensionVersion":"v3.4.3"} |