fix oauth
This commit is contained in:
@@ -407,6 +407,18 @@ export async function fetchAuthSession(token?: string | null): Promise<AuthSessi
|
||||
return apiFetch<AuthSessionResponse>('/auth/session', {}, token);
|
||||
}
|
||||
|
||||
export async function approveOAuthAuthorization(params: URLSearchParams, token: string) {
|
||||
const query = new URLSearchParams();
|
||||
params.forEach((value, key) => {
|
||||
if (key !== 'userId') query.set(key, value);
|
||||
});
|
||||
return apiFetch<{ redirectUrl?: string }>(
|
||||
`/oauth/authorize?${query.toString()}`,
|
||||
{ headers: { Accept: 'application/json' } },
|
||||
token
|
||||
);
|
||||
}
|
||||
|
||||
export async function refreshAuthSession(): Promise<RefreshSessionResponse> {
|
||||
if (typeof window === 'undefined') {
|
||||
throw new ApiError('Refresh token недоступен на сервере', 401, 'NO_REFRESH');
|
||||
|
||||
Reference in New Issue
Block a user