Update api.tsx
Add resource to check whether usernames and emails exist
This commit is contained in:
parent
1cb7509299
commit
51f0dbce32
1 changed files with 7 additions and 1 deletions
|
|
@ -45,11 +45,17 @@ class Api {
|
||||||
} as EndpointMap
|
} as EndpointMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
search(query: string) {
|
search(query: string) {
|
||||||
const resourceUrl = `${this.url}/${name}`
|
const resourceUrl = `${this.url}/${name}`
|
||||||
return axios.get(`${resourceUrl}/search?query=${query}`)
|
return axios.get(`${resourceUrl}/search?query=${query}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check(resource: string, value: string) {
|
||||||
|
const resourceUrl = `${this.url}/check/${resource}`
|
||||||
|
return axios.post(resourceUrl, {
|
||||||
|
[resource]: value
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const api: Api = new Api({ url: process.env.SIERO_API_URL || 'http://127.0.0.1:3000/api/v1' })
|
const api: Api = new Api({ url: process.env.SIERO_API_URL || 'http://127.0.0.1:3000/api/v1' })
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue