feat: complete security overhaul with JWT backend and authenticated frontend API
This commit is contained in:
17
frontend/migrate_fetch.ps1
Normal file
17
frontend/migrate_fetch.ps1
Normal file
@@ -0,0 +1,17 @@
|
||||
$compDir = "src\components"
|
||||
$files = Get-ChildItem -Path $compDir -Filter "*.tsx"
|
||||
|
||||
foreach ($file in $files) {
|
||||
$path = $file.FullName
|
||||
$content = [System.IO.File]::ReadAllText($path, [System.Text.Encoding]::UTF8)
|
||||
|
||||
if ($content.Contains("await fetch(")) {
|
||||
if (-not $content.Contains("from '../api'")) {
|
||||
$content = "import { apiFetch } from '../api';" + [System.Environment]::NewLine + $content
|
||||
}
|
||||
$content = $content.Replace("await fetch(", "await apiFetch(")
|
||||
[System.IO.File]::WriteAllText($path, $content, [System.Text.Encoding]::UTF8)
|
||||
Write-Host "Updated component: $($file.Name)"
|
||||
}
|
||||
}
|
||||
Write-Host "Components migration complete."
|
||||
Reference in New Issue
Block a user