@bagelink/sdk 0.0.740 → 0.0.744
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/authClientCode.ts +7 -8
- package/package.json +1 -1
package/bin/authClientCode.ts
CHANGED
|
@@ -23,23 +23,22 @@ ax.interceptors.request.use((config) => {
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
export async function login(username: string, password: string) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
formData.append('grant_type', 'password')
|
|
31
|
-
const { data } = await ax.post('/auth/login', formData, {
|
|
32
|
-
headers: { 'withCredentials': true, 'Content-Type': 'multipart/form-data' },
|
|
33
|
-
})
|
|
26
|
+
const { data } = await ax.post(
|
|
27
|
+
'/auth/login',
|
|
28
|
+
{ username, password }
|
|
29
|
+
)
|
|
34
30
|
localStorage.setItem('access_token', data.access_token)
|
|
35
31
|
}
|
|
32
|
+
|
|
36
33
|
export function logout() {
|
|
37
34
|
localStorage.removeItem('access_token')
|
|
38
35
|
window.location.reload()
|
|
39
36
|
}
|
|
37
|
+
|
|
40
38
|
export async function passwordRecovery(email?: string): Promise<AxiosResponse<Message>> {
|
|
41
39
|
return ax.post(`/auth/password-recovery/${email}`, {})
|
|
42
40
|
}
|
|
41
|
+
|
|
43
42
|
export async function resetPassword(
|
|
44
43
|
newPassword: Partial<NewPassword> & Pick<NewPassword, 'new_password'>
|
|
45
44
|
): Promise<AxiosResponse<Record<string, any>>> {
|