mirror of
https://github.com/myfatemi04/wheelshare-old-backend.git
synced 2025-04-18 10:50:18 -04:00
working login with Ion!
This commit is contained in:
parent
ce1c28acc7
commit
a53a982ec9
11
src/api.ts
11
src/api.ts
|
@ -85,7 +85,7 @@ router.post('/pool', (req, res) => {
|
|||
|
||||
router.patch('/pool', (req, res) => {
|
||||
if (!(req.body.poolID in pools)) {
|
||||
res.json({ status: 'error', error: 'pool not found' });
|
||||
res.json({ status: 'error', error: 'not_found' });
|
||||
} else {
|
||||
let pool = pools[req.body.poolID];
|
||||
pool.title = req.body.title;
|
||||
|
@ -172,18 +172,15 @@ router.post('/my_pools', (req, res) => {
|
|||
}
|
||||
});
|
||||
|
||||
router.get('/create_session', (req, res) => {
|
||||
res.send('hello');
|
||||
});
|
||||
|
||||
router.post('/create_session', (req, res) => {
|
||||
const { code, provider } = req.body;
|
||||
console.log('Creating session: code =', code, 'provider =', provider);
|
||||
createSessionFromCodeAndProvider(code, provider)
|
||||
.then((token) => {
|
||||
res.json({ status: 'success', session_token: token });
|
||||
res.json({ status: 'success', token });
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
console.error('Error when creating session:', error);
|
||||
res.json({ status: 'error' });
|
||||
});
|
||||
});
|
||||
|
|
10
src/index.ts
10
src/index.ts
|
@ -1,13 +1,13 @@
|
|||
import * as bodyParser from 'body-parser';
|
||||
import cors from 'cors';
|
||||
import dotenv from 'dotenv';
|
||||
import express from 'express';
|
||||
import * as api from './api';
|
||||
|
||||
dotenv.config({
|
||||
path: '.env',
|
||||
});
|
||||
|
||||
import * as bodyParser from 'body-parser';
|
||||
import cors from 'cors';
|
||||
import express from 'express';
|
||||
import * as api from './api';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(cors());
|
||||
|
|
Loading…
Reference in New Issue
Block a user