File tree 7 files changed +14
-14
lines changed
7 files changed +14
-14
lines changed Original file line number Diff line number Diff line change 1
- import { $fetch } from "ofetch" ;
1
+ import { ofetch } from "ofetch" ;
2
2
3
3
async function main ( ) {
4
- const response = await $fetch < string > ( "https://api.github.com/markdown" , {
4
+ const response = await ofetch < string > ( "https://api.github.com/markdown" , {
5
5
method : "POST" ,
6
6
// To provide a body, we need to use the `body` option and just use an object.
7
7
body : {
Original file line number Diff line number Diff line change 1
- import { $fetch } from "ofetch" ;
1
+ import { ofetch } from "ofetch" ;
2
2
3
3
async function main ( ) {
4
4
try {
5
- await $fetch ( "https://api.github.com" , {
5
+ await ofetch ( "https://api.github.com" , {
6
6
method : "POST" ,
7
7
} ) ;
8
8
} catch ( error ) {
Original file line number Diff line number Diff line change 1
- import { $fetch } from "ofetch" ;
1
+ import { ofetch } from "ofetch" ;
2
2
3
3
async function main ( ) {
4
- const data = await $fetch ( "https://ungh.cc/repos/unjs/ofetch" ) ;
4
+ const data = await ofetch ( "https://ungh.cc/repos/unjs/ofetch" ) ;
5
5
6
6
console . log ( data ) ;
7
7
}
Original file line number Diff line number Diff line change 1
- import { $fetch } from "ofetch" ;
1
+ import { ofetch } from "ofetch" ;
2
2
3
3
async function main ( ) {
4
- const response = await $fetch ( "https://api.github.com/gists" , {
4
+ const response = await ofetch ( "https://api.github.com/gists" , {
5
5
method : "POST" ,
6
6
headers : {
7
7
Authorization : `token ${ process . env . GH_TOKEN } ` ,
Original file line number Diff line number Diff line change 1
- import { $fetch } from "ofetch" ;
1
+ import { ofetch } from "ofetch" ;
2
2
3
3
async function main ( ) {
4
- const response = await $fetch ( "https://api.github.com/gists" , {
4
+ const response = await ofetch ( "https://api.github.com/gists" , {
5
5
method : "POST" ,
6
6
} ) ; // Be careful, we use the GitHub API directly.
7
7
Original file line number Diff line number Diff line change 1
- import { $fetch } from "ofetch" ;
1
+ import { ofetch } from "ofetch" ;
2
2
3
3
async function main ( ) {
4
- const response = await $fetch (
4
+ const response = await ofetch (
5
5
"https://api.github.com/repos/unjs/ofetch/tags" ,
6
6
{
7
7
query : {
Original file line number Diff line number Diff line change 1
- import { $fetch } from "ofetch" ;
1
+ import { ofetch } from "ofetch" ;
2
2
3
3
interface Repo {
4
4
id : number ;
@@ -9,7 +9,7 @@ interface Repo {
9
9
}
10
10
11
11
async function main ( ) {
12
- const { repo } = await $fetch < { repo : Repo } > (
12
+ const { repo } = await ofetch < { repo : Repo } > (
13
13
"https://ungh.cc/repos/unjs/ofetch"
14
14
) ;
15
15
You can’t perform that action at this time.
0 commit comments