This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gainResult(fn) { | |
| return Promise.race([ | |
| new Promise(resolve => { | |
| try { | |
| const ret = fn((err, result) => { | |
| if (err) { | |
| resolve({ | |
| type: "async", | |
| error: err.message | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const controller = new AbortController() | |
| const signal = controller.signal | |
| setTimeout(() => { | |
| controller.abort() | |
| }, 1000) | |
| fetch(url, { signal }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fetchWithTimeout( url, timeout ) { | |
| return new Promise( (resolve, reject) => { | |
| // Set timeout timer | |
| let timer = setTimeout( | |
| () => reject( new Error('Request timed out') ), | |
| timeout | |
| ); | |
| fetch( url ).then( | |
| response => resolve( response ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700" :for="name">{{ | |
| label | |
| }}</label> | |
| <div class="mt-1 rounded-md shadow-sm"> | |
| <input | |
| :class="classes" | |
| :id="id || name" | |
| :name="name" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ofetch } from "../dist/node.mjs"; | |
| let body; | |
| body = { x: 1 }; // request body is "[object Object]" | |
| // body = JSON.stringify(body); // request body is correctly received | |
| const url ='https://d0348819-d0b4-4913-b739-360dfe6e0eef.mock.pstmn.io/debug'; | |
| const response = await ofetch(url, { body, method: "PATCH" }); | |
| console.log(response); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "type": "chrome", | |
| "request": "launch", | |
| "name": "client: chrome", | |
| "url": "http://localhost:3000", | |
| "webRoot": "${workspaceFolder}", | |
| "userDataDir": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Generated by nuxi | |
| { | |
| "compilerOptions": { | |
| "paths": { | |
| "nitropack/types": [ | |
| "../node_modules/nitropack/types" | |
| ], | |
| "nitropack/runtime": [ | |
| "../node_modules/nitropack/runtime" | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script setup lang="ts"> | |
| import { cn } from "@/lib/utils"; | |
| import { Check, ChevronsUpDown } from "lucide-vue-next"; | |
| import { useField } from "vee-validate"; | |
| const { | |
| name, | |
| placeholder = "Choose an option...", | |
| disabled, | |
| options = [], | |
| } = defineProps<{ |