kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Fixed #119: forced redirection to login even with API_AUTHENTICATION_REQUIRED=False
rodzic
0f5b1c295e
commit
4298c4236e
|
@ -240,6 +240,7 @@ class TagViewSet(viewsets.ReadOnlyModelViewSet):
|
|||
|
||||
class Search(views.APIView):
|
||||
max_results = 3
|
||||
permission_classes = [ConditionalAuthentication]
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
query = request.GET['query']
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fixed forced redirection to login event with API_AUTHENTICATION_REQUIRED=False (#119)
|
|
@ -56,6 +56,9 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
openWebsocket () {
|
||||
if (!this.$store.state.auth.authenticated) {
|
||||
return
|
||||
}
|
||||
let self = this
|
||||
let token = this.$store.state.auth.token
|
||||
// let token = 'test'
|
||||
|
|
|
@ -30,6 +30,9 @@ export default {
|
|||
},
|
||||
apiSettings: {
|
||||
beforeXHR: function (xhrObject) {
|
||||
if (!self.$store.state.auth.authenticated) {
|
||||
return xhrObject
|
||||
}
|
||||
xhrObject.setRequestHeader('Authorization', self.$store.getters['auth/header'])
|
||||
return xhrObject
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
<div class="column">
|
||||
<h2 class="ui header">Music requests</h2>
|
||||
<request-form></request-form>
|
||||
<request-form v-if="$store.state.auth.authenticated"></request-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<router-link class="ui item" to="/library/artists" exact>Artists</router-link>
|
||||
<router-link class="ui item" to="/library/radios" exact>Radios</router-link>
|
||||
<div class="ui secondary right menu">
|
||||
<router-link class="ui item" to="/library/requests/" exact>
|
||||
<router-link v-if="$store.state.auth.authenticated" class="ui item" to="/library/requests/" exact>
|
||||
Requests
|
||||
<div class="ui teal label">{{ requestsCount }}</div>
|
||||
</router-link>
|
||||
|
@ -32,8 +32,11 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
fetchRequestsCount () {
|
||||
if (!this.$store.state.authenticated) {
|
||||
return
|
||||
}
|
||||
let self = this
|
||||
axios.get('requests/import-requests', {params: {status: 'pending'}}).then(response => {
|
||||
axios.get('requests/import-requests/', {params: {status: 'pending'}}).then(response => {
|
||||
self.requestsCount = response.data.count
|
||||
})
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue