mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-26 12:33:25 +00:00
v1.0.13 (#46)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { githubAPI } from '$api';
|
||||
import type { Request } from '@sveltejs/kit';
|
||||
import mongoose from 'mongoose';
|
||||
import User from '$models/User';
|
||||
import Settings from '$models/Settings';
|
||||
import cuid from 'cuid';
|
||||
import jsonwebtoken from 'jsonwebtoken';
|
||||
import { githubAPI } from '$lib/api/github';
|
||||
|
||||
export async function get(request: Request) {
|
||||
const code = request.query.get('code');
|
||||
@@ -17,7 +17,7 @@ export async function get(request: Request) {
|
||||
{ headers: { accept: 'application/json' } }
|
||||
)
|
||||
).json();
|
||||
const { avatar_url, id } = await (await githubAPI(request, '/user', access_token)).body;
|
||||
const { avatar_url } = await (await githubAPI(request, '/user', access_token)).body;
|
||||
const email = (await githubAPI(request, '/user/emails', access_token)).body.filter(
|
||||
(e) => e.primary
|
||||
)[0].email;
|
||||
@@ -41,11 +41,10 @@ export async function get(request: Request) {
|
||||
try {
|
||||
await newUser.save();
|
||||
await defaultSettings.save();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} catch (error) {
|
||||
return {
|
||||
status: 500,
|
||||
body: e
|
||||
error: error.message || error
|
||||
};
|
||||
}
|
||||
} else {
|
||||
@@ -73,12 +72,11 @@ export async function get(request: Request) {
|
||||
});
|
||||
try {
|
||||
await newUser.save();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} catch (error) {
|
||||
return {
|
||||
status: 500,
|
||||
body: {
|
||||
error: e
|
||||
error: error.message || error
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -103,8 +101,6 @@ export async function get(request: Request) {
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
console.log('error happened');
|
||||
console.log(error);
|
||||
return { status: 500, body: { ...error } };
|
||||
return { status: 500, body: { error: error.message || error } };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user