u
This commit is contained in:
16
src/store/mcp/consumeAuthCode.js
Normal file
16
src/store/mcp/consumeAuthCode.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { CONSUME_AUTH_CODE as MSSQL_CONSUME } from '../../providers/mssql/queries/mcp.js';
|
||||
import { CONSUME_AUTH_CODE as SQLITE_CONSUME } from '../../providers/sqlite3/queries/mcp.js';
|
||||
|
||||
export default function consumeAuthCode(provider) {
|
||||
const sql = provider.dialect === 'sqlite3' ? SQLITE_CONSUME : MSSQL_CONSUME;
|
||||
/**
|
||||
* Marks an authorization code as used.
|
||||
*
|
||||
* @param {string} code - The authorization code to mark used.
|
||||
* @returns {Promise<boolean>} True once marked.
|
||||
*/
|
||||
return async (code) => {
|
||||
await provider.query(sql, { code });
|
||||
return true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user