⧉
CodeMerger
Full File
// User authentication service class AuthService { constructor(apiKey) { this.apiKey = apiKey; this.baseUrl = 'https://api.example.com'; } async login(email, password) { const response = await fetch(`${this.baseUrl}/auth/login`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${this.apiKey}` }, body: JSON.stringify({ email, password }) }); return response.json(); } }
New Code to Merge
// Add logout functionality async logout() { const response = await fetch(`${this.baseUrl}/auth/logout`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}` } }); if (response.ok) { localStorage.removeItem('authToken'); } return response.json(); }
⧬
Merge Code
AI is merging your code...
✓
Code merged successfully!
Merged Result
// User authentication service class AuthService { constructor(apiKey) { this.apiKey = apiKey; this.baseUrl = 'https://api.example.com'; } async login(email, password) { const response = await fetch(`${this.baseUrl}/auth/login`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${this.apiKey}` }, body: JSON.stringify({ email, password }) }); return response.json(); } async logout() { const response = await fetch(`${this.baseUrl}/auth/logout`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}` } }); if (response.ok) { localStorage.removeItem('authToken'); } return response.json(); } }